Macro to select "last used column + 1"

  • Thread starter Thread starter johan
  • Start date Start date
J

johan

Hello,

Is there a simple macro to select column C till the last one + 1
column extra.
For example....
I used column C till K, so... I want to select C till L (one more
than the last one used).

regards,
Johan
 
you don't say how many rows are involved, so this just selects row 1. maybe you
can adapt it. i just use select here as an example.

Sub test()
Dim ws As Worksheet
Dim lastcol As Long
Set ws = Worksheets("Sheet1")
lastcol = ws.Cells(1, Columns.Count).End(xlToLeft).Column + 1
ws.Range(ws.Cells(1, 3), ws.Cells(1, lastcol)).Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top