Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Macro to select "last used column + 1"

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Macro to select "last used column + 1"

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

--


Gary


"johan" wrote in message
ps.com...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i select a column when using "exact" formula? JLEXCEL Excel Discussion (Misc queries) 0 March 13th 07 04:01 PM
How to select a single "column" of a VBA array? pinkfloydfan Excel Programming 5 December 17th 06 03:37 AM
"Control" plus "click" doesn't allow me to select multiple cells Ken Cooke New Users to Excel 0 September 25th 06 04:46 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM
"Select Column method or property not available because some/all of object doesn't refer to table" Steven Rosenberg Excel Programming 0 August 18th 03 04:41 AM


All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"