ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding a used / filled column (https://www.excelbanter.com/excel-programming/418564-finding-used-filled-column.html)

ogopogo5

Finding a used / filled column
 
Is there a way to wtite a VB that will look for a column that is used
/ filled? I.E. Colums A4, B4, C4 and D4 are empty. It will skips the
empty columns until it finds and selects an used / filled column, in
this case column E4.

Ogopogo5

*** Sent via Developersdex http://www.developersdex.com ***

Jim Thomlinson

Finding a used / filled column
 
this code assumes that the empty cells are not formulas returning empty
strings...

dim rng as range

set rng = range("a4")
if isempty(rng) then set rng = rng.end(xltoright)
rng.select



--
HTH...

Jim Thomlinson


"ogopogo5" wrote:

Is there a way to wtite a VB that will look for a column that is used
/ filled? I.E. Colums A4, B4, C4 and D4 are empty. It will skips the
empty columns until it finds and selects an used / filled column, in
this case column E4.

Ogopogo5

*** Sent via Developersdex http://www.developersdex.com ***


ogopogo5

Finding a used / filled column
 
Hi Jim
I copied and pasted the VB and it works. Thank you very much for helping
out.

Ogopogo5

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com