Copy-Paste - Same Sheet and Process, but for the entire spreadsheet2019 Community Moderator ElectionHow to avoid using Select in Excel VBAVBA Copy and paste a range of numbersHow do you copy and paste into Git BashHow do you select the entire excel sheet with Range using Macro in VBA?Copy and paste to another sheet first empty row, pastes over the previous row if first cell is emptyCopy Range From One Sheet Paste Part of Range In Same Sheet Based On Cell Value On Another SheetCopy Range Sheet1 Paste in Active Cell Sheet 2Excel VBA: How to copy multiple ranges from same sheetMacro to Copy and Paste into Email bodyHow do I use a date reference on 1 sheet to use as a place to paste data on multiple other sheets but copied on same sheet as to be pastedCopy/Paste Yellow Highlighted Cells in a new WorkSheet VBA

Fastest way to pop N items from a large dict

Violin - Can double stops be played when the strings are not next to each other?

Math equation in non italic font

Why did it take so long to abandon sail after steamships were demonstrated?

Examples of transfinite towers

Is it insecure to send a password in a `curl` command?

Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible

Official degrees of earth’s rotation per day

What is the Japanese sound word for the clinking of money?

Welcoming 2019 Pi day: How to draw the letter π?

What do you call the act of removing a part of a word and replacing it with an apostrophe

What is a ^ b and (a & b) << 1?

Are all passive ability checks floors for active ability checks?

Do I need to be arrogant to get ahead?

Shortcut for setting origin to vertex

If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how?

Bach's Toccata and Fugue in D minor breaks the "no parallel octaves" rule?

Equivalents to the present tense

Why does overlay work only on the first tcolorbox?

Python if-else code style for reduced code for rounding floats

Knife as defense against stray dogs

Bacteria contamination inside a thermos bottle

Is it normal that my co-workers at a fitness company criticize my food choices?

How could a scammer know the apps on my phone / iTunes account?



Copy-Paste - Same Sheet and Process, but for the entire spreadsheet



2019 Community Moderator ElectionHow to avoid using Select in Excel VBAVBA Copy and paste a range of numbersHow do you copy and paste into Git BashHow do you select the entire excel sheet with Range using Macro in VBA?Copy and paste to another sheet first empty row, pastes over the previous row if first cell is emptyCopy Range From One Sheet Paste Part of Range In Same Sheet Based On Cell Value On Another SheetCopy Range Sheet1 Paste in Active Cell Sheet 2Excel VBA: How to copy multiple ranges from same sheetMacro to Copy and Paste into Email bodyHow do I use a date reference on 1 sheet to use as a place to paste data on multiple other sheets but copied on same sheet as to be pastedCopy/Paste Yellow Highlighted Cells in a new WorkSheet VBA










0















I'm new to VBA coding (I mostly work with R) and I am having trouble writing a macro to copy and paste. Specifically, I can do the first command fine, but when I go to the next row to do the same thing, it reverts back to the initial cell.



Here's the code that I'm working with:



Keyboard Shortcut: Ctrl+h

Range("B2").Copy Range("C1")
Range("B4").Copy Range("C3")
Range("B6").Copy Range("C5")


And so on...
This does exactly what I want it to do, but I was wondering if there is a way to generalize it so that I can highlight the first cell of each "block" that I wish to do this to (i.e., A1,A2,B1,B2,C1,C2 etc.) and just use the keyboard shortcut. I got it to work partially using:



 Sub Format()

' Format Macro

' Keyboard Shortcut: Ctrl+h

Selection.Cut
ActiveCell.Offset(-1, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Range("A1").Select
Selection.EntireRow.Delete

End Sub


But that always reverts back to the initial cell (A1 in this case) once I move on to the next block.



Thanks for your help!










share|improve this question
























  • What do you want to do, copy or cut the active cell up 1 and 1 to the right? You should have a look at stackoverflow.com/questions/10714251/…

    – SJR
    Mar 6 at 20:47











  • I suppose it doesn't matter whether I copy or cut the cell and move it up 1 right 1 because I am ultimately removing the row that the cell was cut or copied from entirely. I assume that there's not that much of a difference between cutting and copying in terms of code (aside from the obvious cut vs. copy). I have a for loop written that gets rid of the rows after everything is copied, I just cant figure out how to do the initial copying or cutting.

    – Cody_15243
    Mar 6 at 20:51















0















I'm new to VBA coding (I mostly work with R) and I am having trouble writing a macro to copy and paste. Specifically, I can do the first command fine, but when I go to the next row to do the same thing, it reverts back to the initial cell.



Here's the code that I'm working with:



Keyboard Shortcut: Ctrl+h

Range("B2").Copy Range("C1")
Range("B4").Copy Range("C3")
Range("B6").Copy Range("C5")


And so on...
This does exactly what I want it to do, but I was wondering if there is a way to generalize it so that I can highlight the first cell of each "block" that I wish to do this to (i.e., A1,A2,B1,B2,C1,C2 etc.) and just use the keyboard shortcut. I got it to work partially using:



 Sub Format()

' Format Macro

' Keyboard Shortcut: Ctrl+h

Selection.Cut
ActiveCell.Offset(-1, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Range("A1").Select
Selection.EntireRow.Delete

End Sub


But that always reverts back to the initial cell (A1 in this case) once I move on to the next block.



Thanks for your help!










share|improve this question
























  • What do you want to do, copy or cut the active cell up 1 and 1 to the right? You should have a look at stackoverflow.com/questions/10714251/…

    – SJR
    Mar 6 at 20:47











  • I suppose it doesn't matter whether I copy or cut the cell and move it up 1 right 1 because I am ultimately removing the row that the cell was cut or copied from entirely. I assume that there's not that much of a difference between cutting and copying in terms of code (aside from the obvious cut vs. copy). I have a for loop written that gets rid of the rows after everything is copied, I just cant figure out how to do the initial copying or cutting.

    – Cody_15243
    Mar 6 at 20:51













0












0








0








I'm new to VBA coding (I mostly work with R) and I am having trouble writing a macro to copy and paste. Specifically, I can do the first command fine, but when I go to the next row to do the same thing, it reverts back to the initial cell.



Here's the code that I'm working with:



Keyboard Shortcut: Ctrl+h

Range("B2").Copy Range("C1")
Range("B4").Copy Range("C3")
Range("B6").Copy Range("C5")


And so on...
This does exactly what I want it to do, but I was wondering if there is a way to generalize it so that I can highlight the first cell of each "block" that I wish to do this to (i.e., A1,A2,B1,B2,C1,C2 etc.) and just use the keyboard shortcut. I got it to work partially using:



 Sub Format()

' Format Macro

' Keyboard Shortcut: Ctrl+h

Selection.Cut
ActiveCell.Offset(-1, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Range("A1").Select
Selection.EntireRow.Delete

End Sub


But that always reverts back to the initial cell (A1 in this case) once I move on to the next block.



Thanks for your help!










share|improve this question
















I'm new to VBA coding (I mostly work with R) and I am having trouble writing a macro to copy and paste. Specifically, I can do the first command fine, but when I go to the next row to do the same thing, it reverts back to the initial cell.



Here's the code that I'm working with:



Keyboard Shortcut: Ctrl+h

Range("B2").Copy Range("C1")
Range("B4").Copy Range("C3")
Range("B6").Copy Range("C5")


And so on...
This does exactly what I want it to do, but I was wondering if there is a way to generalize it so that I can highlight the first cell of each "block" that I wish to do this to (i.e., A1,A2,B1,B2,C1,C2 etc.) and just use the keyboard shortcut. I got it to work partially using:



 Sub Format()

' Format Macro

' Keyboard Shortcut: Ctrl+h

Selection.Cut
ActiveCell.Offset(-1, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Range("A1").Select
Selection.EntireRow.Delete

End Sub


But that always reverts back to the initial cell (A1 in this case) once I move on to the next block.



Thanks for your help!







excel vba copy-paste






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 8:00









Pᴇʜ

23.9k62952




23.9k62952










asked Mar 6 at 20:39









Cody_15243Cody_15243

1




1












  • What do you want to do, copy or cut the active cell up 1 and 1 to the right? You should have a look at stackoverflow.com/questions/10714251/…

    – SJR
    Mar 6 at 20:47











  • I suppose it doesn't matter whether I copy or cut the cell and move it up 1 right 1 because I am ultimately removing the row that the cell was cut or copied from entirely. I assume that there's not that much of a difference between cutting and copying in terms of code (aside from the obvious cut vs. copy). I have a for loop written that gets rid of the rows after everything is copied, I just cant figure out how to do the initial copying or cutting.

    – Cody_15243
    Mar 6 at 20:51

















  • What do you want to do, copy or cut the active cell up 1 and 1 to the right? You should have a look at stackoverflow.com/questions/10714251/…

    – SJR
    Mar 6 at 20:47











  • I suppose it doesn't matter whether I copy or cut the cell and move it up 1 right 1 because I am ultimately removing the row that the cell was cut or copied from entirely. I assume that there's not that much of a difference between cutting and copying in terms of code (aside from the obvious cut vs. copy). I have a for loop written that gets rid of the rows after everything is copied, I just cant figure out how to do the initial copying or cutting.

    – Cody_15243
    Mar 6 at 20:51
















What do you want to do, copy or cut the active cell up 1 and 1 to the right? You should have a look at stackoverflow.com/questions/10714251/…

– SJR
Mar 6 at 20:47





What do you want to do, copy or cut the active cell up 1 and 1 to the right? You should have a look at stackoverflow.com/questions/10714251/…

– SJR
Mar 6 at 20:47













I suppose it doesn't matter whether I copy or cut the cell and move it up 1 right 1 because I am ultimately removing the row that the cell was cut or copied from entirely. I assume that there's not that much of a difference between cutting and copying in terms of code (aside from the obvious cut vs. copy). I have a for loop written that gets rid of the rows after everything is copied, I just cant figure out how to do the initial copying or cutting.

– Cody_15243
Mar 6 at 20:51





I suppose it doesn't matter whether I copy or cut the cell and move it up 1 right 1 because I am ultimately removing the row that the cell was cut or copied from entirely. I assume that there's not that much of a difference between cutting and copying in terms of code (aside from the obvious cut vs. copy). I have a for loop written that gets rid of the rows after everything is copied, I just cant figure out how to do the initial copying or cutting.

– Cody_15243
Mar 6 at 20:51












1 Answer
1






active

oldest

votes


















1














Something like this? This is a one-off operation, but could be broadened if there some broader pattern exists.



Sub x()

With ActiveCell
.Offset(-1, 1).Value = .Value
.EntireRow.Delete
End With

End Sub





share|improve this answer























  • That did the trick. Thank you!

    – Cody_15243
    Mar 6 at 21:24










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031791%2fcopy-paste-same-sheet-and-process-but-for-the-entire-spreadsheet%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Something like this? This is a one-off operation, but could be broadened if there some broader pattern exists.



Sub x()

With ActiveCell
.Offset(-1, 1).Value = .Value
.EntireRow.Delete
End With

End Sub





share|improve this answer























  • That did the trick. Thank you!

    – Cody_15243
    Mar 6 at 21:24















1














Something like this? This is a one-off operation, but could be broadened if there some broader pattern exists.



Sub x()

With ActiveCell
.Offset(-1, 1).Value = .Value
.EntireRow.Delete
End With

End Sub





share|improve this answer























  • That did the trick. Thank you!

    – Cody_15243
    Mar 6 at 21:24













1












1








1







Something like this? This is a one-off operation, but could be broadened if there some broader pattern exists.



Sub x()

With ActiveCell
.Offset(-1, 1).Value = .Value
.EntireRow.Delete
End With

End Sub





share|improve this answer













Something like this? This is a one-off operation, but could be broadened if there some broader pattern exists.



Sub x()

With ActiveCell
.Offset(-1, 1).Value = .Value
.EntireRow.Delete
End With

End Sub






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 6 at 21:05









SJRSJR

13.2k31219




13.2k31219












  • That did the trick. Thank you!

    – Cody_15243
    Mar 6 at 21:24

















  • That did the trick. Thank you!

    – Cody_15243
    Mar 6 at 21:24
















That did the trick. Thank you!

– Cody_15243
Mar 6 at 21:24





That did the trick. Thank you!

– Cody_15243
Mar 6 at 21:24



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031791%2fcopy-paste-same-sheet-and-process-but-for-the-entire-spreadsheet%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Алба-Юлія

Захаров Федір Захарович