Chalenge ! Unable to figure out how to do this.

ajr123

New Member
Joined
Apr 5, 2002
Messages
9
I have a spread sheet that I need to select a range of cells The goal is to create this selection based on the the last position of data on the first column, I now how to do this with rows but unable to to do this with this situation.
Thanks Please let me know if you need futher clarification.

Please a see the table below.

J K L M N
Symbol Company Name Last High Low Volume High Low
lwin
lwin THIS IS THE AREA NEED TO SELECT THE SELECTION SHOULD START K3 & END ON COLUMN Z BASED ON THE LAST CELL REFERENCE THAT HAS DATA FROM COLUMN J , THIS WILL CHANGE EVERY DAY.
lwin
lwin
lwin
lwin
lwin
lwin

LAST CELL REF
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

Try,

Sub test()
Dim lastrow As Long

lastrow = Cells(Rows.Count, "J").End(xlUp).Row
Cells(lastrow, "J").Offset(0, 1).Resize(1, 16).Select
End Sub

HTH,
Jay
 
Upvote 0
One more question. Now that I have selected the bottom of the area I want, how do I basically hold downt he shift key and select the range up to one row before the top?
 
Upvote 0
Hi,

Rewrite the routine to do what you want. I don't know exactly what you need, so try the following. I have commented out another option, too.

'-------------
Sub test()
Dim lastrow As Long, firstrow As Long

lastrow = Cells(Rows.Count, "J").End(xlUp).Row
firstrow = Cells(lastrow, "J").End(xlUp).Row

If lastrow = 1 Then
Cells(lastrow, "J").Offset(0, 1).Resize(1, 16).Select
Else
Range(Cells(2, "K"), Cells(lastrow, "Z")).Select

'''' or use something like this
'''' Range(Cells(firstrow + 1, "K"), Cells(lastrow, "Z")).Select
End If

End Sub
'--------------

Bye,
Jay
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,949
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top