Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dave Peterson
 
Posts: n/a
Default Check COlumn - Excel VBA

I think I'd use something like:

if activecell.column = 1 _
and intersect(selection.entirecolumn,rows(1)).cells.co unt = 1 then
MsgBox " Test 111"
else
MsgBox "Test 555"
end if

(But I'm repeating myself <vbg.)

magix wrote:

<<snipped

Hi Dave, the code :

"If ActiveCell.Column = 1 And Selection.Columns.Count = 1 And
Selection.Areas.Count = 1 Then"

works fine as well as your new code in my other posting. But I got one bug.

Let say my code in the macro button is like this:
If ActiveCell.Column = 1 And Selection.Columns.Count = 1 And
Selection.Areas.Count = 1 Then
MsgBox " Test 111"
else
MsgBox "Test 555"

Then in Column A, let say if I select cell A2, then press CTRL, then select
A5, and then press the macro button, it will prompt me Test 555, instead of
Test 111. That's the bug.

Meaning that if select multiple discontiguous areas in Column A only, it
will return false for the IF statement:
"If ActiveCell.Column = 1 And Selection.Columns.Count = 1 And
Selection.Areas.Count = 1 "

How can I fix that ?

Thanks in advance.

Regards.


--

Dave Peterson
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
Categorizing an excel column Anna Excel Discussion (Misc queries) 2 July 15th 05 07:32 AM
match and count words David Excel Worksheet Functions 5 July 4th 05 02:24 AM
Check boxes in a column BenJAMMIN Excel Discussion (Misc queries) 5 April 9th 05 11:11 PM
Column A is Town, Column B is names. How can Excel add & tell how. Cindy Charts and Charting in Excel 3 January 13th 05 07:27 PM
How do I sort a column of formulas in Excel? Gordon Excel Discussion (Misc queries) 2 November 27th 04 01:55 AM


All times are GMT +1. The time now is 04:35 AM.

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

About Us

"It's about Microsoft Excel"