![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
Hi,
Im having a hard time trying to do the following. I want my macro to copy a range, but the range will always be different. I would like to find the last cell with data in column B, and the returned row will be the last row in my range. Then, I would like to select A1:D(whatever row the search in B returned). I can find the last row in B with : Worksheets("Changes Sheet").Range("B65536").End(xlUp) But how do i specify the range A1 to D and this row? Many thanks! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
lrow = Worksheets("Changes Sheet").Range("B65536").End(xlUp).Row Set MyRange = Worksheets("Changes Sheet").Range("A1","D" & lrow) or Set MyRange = Worksheets("Changes Sheet").Range("A1", Worksheets("Changes Sheet").Range("B65536").End(xlUp).Offset(,2)) |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
thanks very much Juan!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|