View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Hide columns with certain coditions


This will now give you the message if a non numeric value is entered in A5.

Sub hidCol()
Dim sh As Worksheet
Set sh = ActiveSheet
If Not IsNumeric(Range("A5").Value) Then
MsgBox "The value is not numeric"
ElseIf sh.Range("A5").Value < 0 Then
Columns("D:F").Hidden = True
ElseIf sh.Range("A5").Value = 0 Then
Columns("D:F").Hidden = False
End If
End Sub

I overlooked the fact that an alpha character is considered by VBA to be a
value greater than a numeric character and therefore, greater than zero.


<moosa Abrahams wrote in message
...
Hi there
I need to hide some columns in excel 2003

example

question in row A1 answer in Row A5
iF THE ANSWER IN a5 is positive then columns d-f must be visible or active
If the answer is negative row D-F should be hidden

My excel knowhow is medium

Any help will be appreciated

Mo


EggHeadCafe - Software Developer Portal of Choice
.NET Remoting - Marshal Objects ByRef
http://www.eggheadcafe.com/tutorials...marshal-o.aspx