How can I get a macro to opperate from a different sheet

C

Chris

I am tring to set up a macro on sheet 11 that will change values in sheet 13
of my work book. I have set up a button on sheet13 that transfers values from
1 range of cells to another range of cells. Is it posible to have the button
work from sheet 11 instead of sheet 13. This is the macro I have for sheet
13.

Thanks for your help
regards
Chris


Sub update()

ActiveSheet.Range("I20:I23").Copy
Range("F20").Select
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub
 
G

Gary Keramidas

untested, but give it a try

Worksheets(11).Range("I20:I23").Copy
worksheets(13).Range("F20").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub
 
V

Vital_ar

Dear Chris,
Just add this,
Worksheets("Sheet13").Activate

and then you macro will be

Sub update()
Worksheets("Sheet13").Activate
ActiveSheet.Range("I20:I23").Copy
Range("F20").Select
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub

Regards
 
C

Chris

Hi Garry
Thanks for that, had to change it a little in the first part from
Worksheet(11) to Worksheet(13).
 

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