View Full Version : Multiple column select in VBA
Normz
01-16-2017, 08:47 AM
Hi Guys,
How it can be done in VBA codes? Selecting multiple column but not in sequential.
Thanks,
JKwan
01-16-2017, 08:53 AM
Range("A1:A10,C1:C10,G1:G10").Select
Normz
01-16-2017, 09:00 AM
Thanks JKwan, another question. Can it be done by using "Range(Selection, Selection.End(xlDown)).Select"? So I will not input an specific range like A1:A10, because my data everyday have different row count.
Range("A1:A10,C1:C10,G1:G10").Select
Sub M_snb()
Intersect(UsedRange, Range("C:C,F:F")).Select
End Sub
JKwan
01-16-2017, 09:54 AM
you can use snb or below
Sub highlite()
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:A" & LastRow & ",C1:C" & LastRow & ",G1:G" & LastRow).Select
End Sub
Normz
01-16-2017, 10:06 AM
Thanks it worked! :bow:
you can use snb or below
Sub highlite()
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:A" & LastRow & ",C1:C" & LastRow & ",G1:G" & LastRow).Select
End Sub
I tried to use snb answer but it prompt
mikerickson
01-16-2017, 10:46 AM
Try
Intersect(ActiveSheet.UsedRange, Range("C:C,F:F")).Select
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.