VBA Selection to Last Filled Cell

teamktm1307 Posted messages 1 Status Member -  
Tobar4 Posted messages 284 Registration date   Status Member Last intervention   -
Hello,

I have a project for my company to do in Excel involving VBA, but I have an issue...

I actually want to know the line of code that needs to be entered to select from a certain cell to the last filled cell of a table like:

Range("C1:T1000").Select
Selection.Cut

where "T1000" would not be fixed but would represent the last filled value in column T

This is for cutting and pasting tables of different lengths retrieved from another Excel application

Thank you very much

Best regards,

Thibault

Configuration: Windows XP / Internet Explorer 8.0

2 answers

michel_m Posted messages 18903 Registration date   Status Contributor Last intervention   3 320
 
hello
no need to make a loop

there are several methods
lig_fin=cells(cells.rows.count,"T").end(xlup).row Range("C1:T" & ligfin).cut 

(the select-selection should be avoided (comes from the macro recorder but causes huge slowdown of the macro)

or
ligfin=columns("T").find("*",range("T1"),,,,xlprevious).row 

Michel
4
Tobar4 Posted messages 284 Registration date   Status Member Last intervention   94
 
Hello,

I know this post is a bit old, but how do you make selections over multiple ranges (for example: columns A, E, and G)?

Thank you
0