View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
MandrakeDM MandrakeDM is offline
external usenet poster
 
Posts: 3
Default Changing a macro from a specific worksheet to any worksheet

Thanks so much for the help. I'll try it out on Sunday night. Between you and
Jay, I think the problems fixed.

Mandrake

"Gary''s Student" wrote:

The first macro goes to Sheet3 to copy and then returns to Sheet1 to paste:

Sub Macro1()
Sheets("Sheet3").Select
Range("G4:H9").Select
Range("G9").Activate
Selection.Copy
Sheets("Sheet1").Select
Range("C9").Select
ActiveSheet.Paste
End Sub

The next macro "remembers" where it came from and returns the

Sub generall()
Dim s As String
s = ActiveSheet.Name
Sheets("Sheet3").Select
Range("G4:H9").Select
Range("G9").Activate
Selection.Copy
Sheets(s).Select
Range("C9").Select
ActiveSheet.Paste
End Sub

Actually it is not necessary to jump back and forth at all.
--
Gary''s Student - gsnu200753


"MandrakeDM" wrote:

Hi,

I'm creating a series of macros that will access a sheet, copy a header line
and then return to the original worksheet and paste the give header where I
want it to go. I don't have any real problem creating the macro itself.
Where my problem is, is that right now, it's only good for one sheet. The
way the macro reads, it copies the headers and then comes back to the
worksheet that I was on when I originally created the macro. So then, how do
I change the macro from returning to the original sheet and return to the
sheet that I am currently on? Any help would be appreciated.