Find next cloumn
Hello everyone,
I want to find the last column in a row that has information in it. I wrote out the following Worksheets("Current").Range("B2") _ .Copy Destination:= _ Worksheets("Current").Range("ZZ4").End(xlLeft)(1) But have it wrong. I have used this in the past Worksheets("SQL").Cells(rowSource, "A") _ .Copy Destination:= _ Worksheets("QUOTE").Range("G300").End(xlUp)(2) So what is the command to look from right to left? For that matter, is there a good list of Excel VBA commands to reference? I have a function list spreadsheet that gives all of the functions and how to write them (thanks to Norman Harker MVP for providing that), is there a similar document running around for VBA commands? LWhite |
Find next cloumn
Hi L,
Try: With Worksheets("Current") .Range("B2").Copy Destination:= _ .Range("Z4").End(xlToLeft)(1, 2) End With I assume that Range("ZZ4"). was a typo, as Excel only has 256 columns. --- Regards, Norman "L.White" wrote in message ... Hello everyone, I want to find the last column in a row that has information in it. I wrote out the following Worksheets("Current").Range("B2") _ .Copy Destination:= _ Worksheets("Current").Range("ZZ4").End(xlLeft)(1) But have it wrong. I have used this in the past Worksheets("SQL").Cells(rowSource, "A") _ .Copy Destination:= _ Worksheets("QUOTE").Range("G300").End(xlUp)(2) So what is the command to look from right to left? For that matter, is there a good list of Excel VBA commands to reference? I have a function list spreadsheet that gives all of the functions and how to write them (thanks to Norman Harker MVP for providing that), is there a similar document running around for VBA commands? LWhite |
Find next cloumn
Another way to do this is:
dim end as integer do while not isempty(columns(1).cells(end)) end = end +1 Loop End will then contain the column number of the first empty cell. "Norman Jones" wrote: Hi L, Try: With Worksheets("Current") .Range("B2").Copy Destination:= _ .Range("Z4").End(xlToLeft)(1, 2) End With I assume that Range("ZZ4"). was a typo, as Excel only has 256 columns. --- Regards, Norman "L.White" wrote in message ... Hello everyone, I want to find the last column in a row that has information in it. I wrote out the following Worksheets("Current").Range("B2") _ .Copy Destination:= _ Worksheets("Current").Range("ZZ4").End(xlLeft)(1) But have it wrong. I have used this in the past Worksheets("SQL").Cells(rowSource, "A") _ .Copy Destination:= _ Worksheets("QUOTE").Range("G300").End(xlUp)(2) So what is the command to look from right to left? For that matter, is there a good list of Excel VBA commands to reference? I have a function list spreadsheet that gives all of the functions and how to write them (thanks to Norman Harker MVP for providing that), is there a similar document running around for VBA commands? LWhite |
All times are GMT +1. The time now is 08:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com