Hi Jim, i'm stuck again in something similar to my previous question, and
need some help, please. I'm still a newy in VBA and feeling my way in the
dark here.
OK, this time i wrote a code to allow the user to change the selected cells
fill colour. However, to do that the selected cells have to be located in Row
9 only AND has to have NumberFormat = "General". (cells's formatting in row 9
is either GENERAL of TEXT). The code is:
Sub test()
Dim RowsCount As Integer, rowNum As Integer
With Selection
RowsCount = .Rows.Count
rowNum = .Row
If .NumberFormat = "@" Then
MsgBox "The cell's number format < general."
Exit Sub
End If
End With
If rowNum < 9 Or RowsCount < 1 Then
MsgBox "Please ensure that your selection is from Row 9 only."
Exit Sub
Else
MsgBox "all is good."
End If
End Sub
My code that i wrote seems to always check the FIRST cell in the selected
range only! How do i detect if at least one cell in the selected range (not
necessarily the first one) is not formatted as GENERAL?
Many thanks
Tendresse
"Jim Cone" wrote:
If IsNull(.Locked) Or .Locked = True Then
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)