ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   range selection (https://www.excelbanter.com/excel-programming/285402-range-selection.html)

douvid

range selection
 
Hi ,
"A:A, F:F, AC:AC". those 3 columns have a different numbers of rows in each file. let's say x identify the last row.
how do I now select this range to apply a specific format.

I though something like "A1:A" & x but this works only for one column.
How do I select all ?

thanks
douvid

Bob Phillips[_6_]

range selection
 
Hi Douvid,

Is this what you want?

Dim sRange As String
sRange = "A1:A" & Cells(Rows.Count, "A").End(xlUp).Row & "," & _
"F1:F" & Cells(Rows.Count, "F").End(xlUp).Row & "," & _
"AC1:AC" & Cells(Rows.Count, "AC").End(xlUp).Row
Range(sRange).Select

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"douvid" wrote in message
...
Hi ,
"A:A, F:F, AC:AC". those 3 columns have a different numbers of rows in

each file. let's say x identify the last row.
how do I now select this range to apply a specific format.

I though something like "A1:A" & x but this works only for one column.
How do I select all ?

thanks
douvid




J.E. McGimpsey

range selection
 
one way:

With Range("A1:A" & x & ",F1:F" & x & ",AC1:AC" & x)
.Interior.ColorIndex = 3
.NumberFormat = "@"
.Font.ColorIndex = 6
End With

In article ,
douvid wrote:

Hi ,
"A:A, F:F, AC:AC". those 3 columns have a different numbers of rows in each
file. let's say x identify the last row.
how do I now select this range to apply a specific format.

I though something like "A1:A" & x but this works only for one column.
How do I select all ?

thanks
douvid



All times are GMT +1. The time now is 04:17 PM.

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