Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings! I would like to select column H on a worksheet so that I can
search for specified values in Column H. When I click on the column H Header ("H" at the top of the worksheet), all of column H is selected as expected. I then wrote the following macro to select Column H: Sub FindCloseDate() ' FindCloseDate Macro ' Keyboard Shortcut: Ctrl+l Columns("H:H").Select End Sub When I execute this macro, all of columns A through O are selected. The worksheet is somewhat irregular in that I believe it contains some merged cells. I am not sure how to include the actual worksheet in this post. I would like some way of simulating, via an Excel macro, the manual selection of column H on the worksheet such that only column H is selected. Any help or suggestions will be greatly appreciated. -- May you have a most blessed day! Sincerely, Michael Fitzpatrick |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Michael
It would appear that your merged cells run right through column H. This is why so many columns are selected. Most likely it is at the headings in ROW 1 where this is happening so, assuming your merged cells occur in Row 1 the following will highlight all the used cells from H2 to the bottom of your dataset. Sub SelColH() Dim lw As Integer lw = Range("H" & Rows.Count).End(xlUp).Row Range("H2:H" & lw).Select End Sub If in the middle of your dataset, you have a heap of merged cells that run through Column H then I suggest you unmerge those cells. You can almost always replicate the appearance of merged Cells without merging. Hope this helps. Marcus |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings! Thanks a million! That's it!!!
Columns("H:H").UnMerge Columns("H:H").Select With this solution, it matters not what nor where merged cells are. -- May you have a most blessed day! Sincerely, Michael Fitzpatrick "marcus" wrote: Hi Michael It would appear that your merged cells run right through column H. This is why so many columns are selected. Most likely it is at the headings in ROW 1 where this is happening so, assuming your merged cells occur in Row 1 the following will highlight all the used cells from H2 to the bottom of your dataset. Sub SelColH() Dim lw As Integer lw = Range("H" & Rows.Count).End(xlUp).Row Range("H2:H" & lw).Select End Sub If in the middle of your dataset, you have a heap of merged cells that run through Column H then I suggest you unmerge those cells. You can almost always replicate the appearance of merged Cells without merging. Hope this helps. Marcus |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Y-Axis Auto-Scale Min Erroneously Set At Zero | Charts and Charting in Excel | |||
Using VBA macro - how to just chart two selected columns | Excel Programming | |||
A recorded Macro to hide certain selected columns hides non selec. | Excel Programming | |||
Sub erroneously calls another sub | Excel Programming | |||
check for selected columns in a macro | Excel Programming |