Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Columns other than one selected by macro being erroneously selecte

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Columns other than one selected by macro being erroneouslyselecte

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Columns other than one selected by macro being erroneously sel

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Y-Axis Auto-Scale Min Erroneously Set At Zero mvagnier Charts and Charting in Excel 2 April 24th 07 03:44 PM
Using VBA macro - how to just chart two selected columns RLExcelUserTS Excel Programming 0 March 27th 06 05:02 PM
A recorded Macro to hide certain selected columns hides non selec. Mlmotter Excel Programming 2 December 31st 04 02:56 PM
Sub erroneously calls another sub Jay Northrop Excel Programming 2 October 22nd 04 06:14 AM
check for selected columns in a macro philip watson Excel Programming 1 December 2nd 03 09:48 PM


All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"