Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ian ian is offline
external usenet poster
 
Posts: 2
Default Determine last col with data

Need a macro to determine the last col to the right(blanks in between) anc
copy last col to sheet1
Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
ian ian is offline
external usenet poster
 
Posts: 2
Default Determine last col with data

Sorry for the misunderstanding.
I need a macro to find and copy the last col on a worksheet(There will be
blanks between Col A and the last col on the right


"Ron de Bruin" wrote in message
...
You can use a function for that Ian

Function Lastcol(sh As Worksheet)
On Error Resume Next
Lastcol = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End FunctionOn this page tou can find some example codehow you can use
ithttp://www.rondebruin.nl/copy1.htm
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message
...
Last col in a row or last col in the worksheet Ian??

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"ian" wrote in message
ble.rogers.com...
Need a macro to determine the last col to the right(blanks in between)

anc
copy last col to sheet1
Thanks








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Determine last col with data

See the link I posted there you can see how you can use the
function result in your macro.



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"ian" wrote in message
able.rogers.com...
Sorry for the misunderstanding.
I need a macro to find and copy the last col on a worksheet(There will be
blanks between Col A and the last col on the right


"Ron de Bruin" wrote in message
...
You can use a function for that Ian

Function Lastcol(sh As Worksheet)
On Error Resume Next
Lastcol = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End FunctionOn this page tou can find some example codehow you can use
ithttp://www.rondebruin.nl/copy1.htm
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message
...
Last col in a row or last col in the worksheet Ian??

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"ian" wrote in message
ble.rogers.com...
Need a macro to determine the last col to the right(blanks in

between)
anc
copy last col to sheet1
Thanks










  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Determine last col with data

http://www.rondebruin.nl/copy1.htm


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message
...
See the link I posted there you can see how you can use the
function result in your macro.



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"ian" wrote in message
able.rogers.com...
Sorry for the misunderstanding.
I need a macro to find and copy the last col on a worksheet(There will

be
blanks between Col A and the last col on the right


"Ron de Bruin" wrote in message
...
You can use a function for that Ian

Function Lastcol(sh As Worksheet)
On Error Resume Next
Lastcol = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End FunctionOn this page tou can find some example codehow you can use
ithttp://www.rondebruin.nl/copy1.htm
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message
...
Last col in a row or last col in the worksheet Ian??

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"ian" wrote in message
ble.rogers.com...
Need a macro to determine the last col to the right(blanks in

between)
anc
copy last col to sheet1
Thanks












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
I need a formula to determine when the data was last changed Climber of Mtns[_2_] Excel Discussion (Misc queries) 0 December 4th 09 09:51 PM
Massaging data to determine risk DouglasinHawaii Excel Discussion (Misc queries) 2 March 31st 08 05:14 PM
How to determine the cause of missing data after I importing data LMonro Excel Discussion (Misc queries) 7 October 26th 07 04:00 AM
How to determine if a cell's data has been changed aidans Excel Discussion (Misc queries) 3 February 13th 07 03:47 PM
formula to determine the first column containing any data sd Excel Worksheet Functions 5 November 9th 04 08:06 PM


All times are GMT +1. The time now is 08:44 AM.

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

About Us

"It's about Microsoft Excel"