View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Aria[_2_] Aria[_2_] is offline
external usenet poster
 
Posts: 34
Default Find & Delete columns to the left stopping at column B

Don,
I missed something on my previous post. Once I've found "Jan", I
changed the name. So when I ran the code again, it shouldn't find "Jan"
anymore; thus no message should appear.

Any way to stop the message from appearing, if "Jan" is not found? Or,
if "Jan" is already in Column B?

Dim mbox As Button
x = Cells.Find("Jan-*").Column - 1
If x < 1 Then
mbox = MsgBox(Prompt:="Jan will shift to column B", _
Buttons:=vbOKOnly)
Range(Cells(1, 2), Cells(1, x)).EntireColumn.delete
End If

'remaining codes here

Thanks a bunch,
Aria

*** Sent via Developersdex http://www.developersdex.com ***