E
edself
Hello,
I'm totally new to macros in Visual Basic and need help. I'm running Office
2003 in Windows XP.
I tried to record a macro used to copy and rearrange information from one
worksheet to another.
When I recorded the macro, it used hard coded ranges which makes it
impossible to move information to different locations in the destination
spreadsheet. Instead, I'd like the macro to place the information RELATIVE
to the currenly selected cell in the destination worksheet.
I've included the macro text below. Notice all the absolute references on
the "NEW" or destination worksheet. I'd like to convert all those absolute
range references to relative ranges. Is that possible?
Is it possible at the time of recording a macro to tell Excel to keep all
range references relative to the currently active cell in each worksheet?
~~~~~~~~~~~~
Selection.Copy
Sheets("NEW").Select
Range("A51:A58").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=
_
xlNone, SkipBlanks:=False, Transpose:=False
Range("B43:B50").Select
Application.CutCopyMode = False
Selection.Copy
Range("B51").Select
ActiveSheet.Paste
Sheets("2003").Select
Range("C762:J762").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("NEW").Select
Range("C51").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Sheets("2003").Select
Range("K762").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("NEW").Select
Range("D5158").Select
ActiveSheet.Paste
Range("A59").Select
~~~~~~~~~~~~
Thanks in advance for your help!
Ed
I'm totally new to macros in Visual Basic and need help. I'm running Office
2003 in Windows XP.
I tried to record a macro used to copy and rearrange information from one
worksheet to another.
When I recorded the macro, it used hard coded ranges which makes it
impossible to move information to different locations in the destination
spreadsheet. Instead, I'd like the macro to place the information RELATIVE
to the currenly selected cell in the destination worksheet.
I've included the macro text below. Notice all the absolute references on
the "NEW" or destination worksheet. I'd like to convert all those absolute
range references to relative ranges. Is that possible?
Is it possible at the time of recording a macro to tell Excel to keep all
range references relative to the currently active cell in each worksheet?
~~~~~~~~~~~~
Selection.Copy
Sheets("NEW").Select
Range("A51:A58").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=
_
xlNone, SkipBlanks:=False, Transpose:=False
Range("B43:B50").Select
Application.CutCopyMode = False
Selection.Copy
Range("B51").Select
ActiveSheet.Paste
Sheets("2003").Select
Range("C762:J762").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("NEW").Select
Range("C51").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Sheets("2003").Select
Range("K762").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("NEW").Select
Range("D5158").Select
ActiveSheet.Paste
Range("A59").Select
~~~~~~~~~~~~
Thanks in advance for your help!
Ed