Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I make this range that I copy using my macro relative to the
cell I select. If I am at cell B4, I want it copy B4:U4. Range("B1:U1").Select Selection.copy Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In Excel 2000, on the macro recorder while the macro is running, there
is a button to select relative. It looks like this: Sub Macro1() ' ' Macro1 Macro ' Macro recorded 11/1/2007 by Dan Dungan ' ' ActiveCell.Offset(-6, -3).Range("A1:B5").Select End Sub Dan On Nov 1, 9:25 am, wrote: How do I make this range that I copy using my macro relative to the cell I select. If I am at cell B4, I want it copy B4:U4. Range("B1:U1").Select Selection.copy Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One of many ways:
Sub showblock() Set r = ActiveCell Set r2 = Range(r, Range("U1")) r2.Select Selection.Copy End Sub -- Gary''s Student - gsnu200753 " wrote: How do I make this range that I copy using my macro relative to the cell I select. If I am at cell B4, I want it copy B4:U4. Range("B1:U1").Select Selection.copy Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One of many ways:
Except it doesn't work, always copying columns B through U, rows 1 through the activecell's row. I think you meant something like ActiveCell.Range("A1:T1").Copy Bernie |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Activecell.Resize(,20).Copy
Unless you want to select any cell in the row, instead of just in column B: Cells(Activecell.Row,2).Resize(,20).Copy HTH, Bernie MS Excel MVP wrote in message ups.com... How do I make this range that I copy using my macro relative to the cell I select. If I am at cell B4, I want it copy B4:U4. Range("B1:U1").Select Selection.copy Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Relative Range Selection & Paste | Excel Discussion (Misc queries) | |||
XL2K - Conditional Formatting relative to cell selection | Excel Discussion (Misc queries) | |||
Need to delete rows relative to selection | Excel Programming | |||
Copy selection based on relative reference | Excel Programming | |||
textbox selection to relative row? | Excel Programming |