![]() |
Relative Range Selection
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 |
Relative Range Selection
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 |
Relative Range Selection
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 |
Relative Range Selection
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 |
Relative Range Selection
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 |
All times are GMT +1. The time now is 11:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com