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
|