Select activecell.row to last columns

Blunder1

Active Member
Joined
Jun 2, 2010
Messages
250
Hi,

I'm struggling to select a range from B to the last column on a row. I have the below code but cant get it to work. I know this is simple but i just cant get it.

Thanks in advance

Blunder

Code:
lc = Range("IV3").End(xlToLeft).Columns
r = ActiveCell.Row
Range("b" & r & ":" & lc & r).Select
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try

Code:
Dim lc As Long, r As Long
r = ActiveCell.Row
lc = Cells(r, Columns.Count).End(xlToLeft).Column
Range(Cells(r, 2), Cells(r, lc)).Select
 
Upvote 0
Try

Range(Cells(r, "B"), Cells(r, lc))


Note, that if you qualify the sheet, you must do it on Range AND both Cells

Like
Sheets("Sheet1").Range(Sheets("Sheet1").Cells(r, "B"), Sheets("Sheet1").Cells(r, lc))


Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,242
Members
452,898
Latest member
Capolavoro009

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