ActiveSheet.Columns(ActiveCell.Column).Rows(3).Select ---- I'm trying to select multiple rows (cells) in the active column.

healeydm

New Member
Joined
Mar 5, 2024
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I'm trying to select specific rows in the active column - I've found the above code to work, but I need to be able to select rows 3, 10, 20. I've tried a few different codes for this, but all of them have selected the entire row and not just the row number in the active column.

VBA Code:
ActiveSheet.Columns(ActiveCell.Column).Rows(3).Select
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Am I not understanding your requirements right? If you select entire rows, what do the column selection have to do with it?

Re: "row number in the active column"
Do you mean to select only the cells in that particular Column, not the whole Rows?
 
Last edited:
Upvote 0
Am I not understanding your requirements right? If you select entire rows, what do the column selection have to do with it?
My column range is dynamic, and I'm trying to select the specific cells in the active column. For example, if my active column is M I'd need M3, M10, and M20. Sorry, I'm trying to figure out the best way to explain it.

1709668891260.png
 
Upvote 0
Select a cell in the Column in question and run this snippet.
Code:
Sub Maybe_So()
Dim rwRng As Range, curCol As Long
curCol = ActiveCell.Column
    Set rwRng = Union(Cells(3, curCol), Cells(10, curCol), Cells(20, curCol))
rwRng.Select
End Sub
 
Upvote 0
Solution
Another (shorter) possibility
Code:
Sub Thanks_To_Fluff()
    Intersect(Columns(ActiveCell.Column), Range("3:3,10:10,20:20")).Select
End Sub
 
Upvote 0
Select a cell in the Column in question and run this snippet.
Code:
Sub Maybe_So()
Dim rwRng As Range, curCol As Long
curCol = ActiveCell.Column
    Set rwRng = Union(Cells(3, curCol), Cells(10, curCol), Cells(20, curCol))
rwRng.Select
End Sub
This worked great, thank you so much!!
 
Upvote 0
Thank you for the update and good luck. You even have a spare solution to try.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top