Macro

C

cvgairport

Hi everyone -

I have a spreadsheet with multiple tabs. I have a need at the start of the
month to copy several sections on different tabs to other places on those
same tabs. Right now the macro I developed copies a single section to
another place:

Range("A17:p30") = Range("A2:p15").Value

I would like to stack these types of commands within a single macro to do
the copying of the various sections but I don't know how to, within the
macro, switch tabs.

Any help would be appreciated.

Amy
 
D

Dave Peterson

Your code doesn't really copy the values--it just assigns them.

And you don't have to select/activate a worksheet to work on it.

worksheets("sheet999").range("A17:p30").value _
= worksheets("sheet888").range("a2:p15").value

If you want to copy, er, assign a specific range from a specific sheet, you
could activate the new sheet and then use something like:

ActiveSheet.range("A17:p30").value _
= worksheets("myMasterSheetNameHere").range("a2:p15").value
 
J

JCS

Hi Amy,

To programatically switch tabs, try: Sheets("Sheet2").Select Substitute
Sheet2 with the name(s) of your sheet tabs. Please press Yes if this helped
you.

JCS
 
C

cvgairport

Thanks! it appears to work!

JCS said:
Hi Amy,

To programatically switch tabs, try: Sheets("Sheet2").Select Substitute
Sheet2 with the name(s) of your sheet tabs. Please press Yes if this helped
you.

JCS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top