select last column

lecet444

Board Regular
Joined
May 18, 2011
Messages
91
Code:
LR = Range("B" & Rows.Count).End(xlUp).Row
LC = Range(4, Columns.Count).End(xlToleft).Column

LC doesnt work what am i doing wrong, i have LR works fine...
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi,

Range won't accept 4 so you need to use Cells:

Code:
Cells(4, Columns.Count).End(xlToLeft).Column
 
Upvote 0
Or if you are interested in using Range then:
Code:
LC = Range("XFD4").End(xlToLeft).Column
 
Upvote 0
Sheets("sheet1").Range("A13").Value = Sheets("sheet1").Range(LC & "3").Value

when i put here...it says object defined error
 
Upvote 0
Range object wouldn't work like that. Here you will have to use Cells object as shown by njimack like:
Code:
Sheets("sheet1").Range("A13").Value = Sheets("sheet1").Cells(3, LC).Value
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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