ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If statement not working right (https://www.excelbanter.com/excel-programming/334176-if-statement-not-working-right.html)

TimT

If statement not working right
 
I have an if statement that if range name "tax_r" = true then column E should
be hidden.
I believe that there is a problem with my code and I can't see it.

Private Sub Enter_Click()

Worksheets("Intro").Visible = False

Sheet3.Activate
frm_Data.Show vbModeless

Dim TaxType As String
With Worksheets("vlookup")

TaxType = .Range("Tax_r").Value

End With

If TaxType = "TRUE" Then
Columns("E:E").Select
Selection.EntireColumn.Hidden = True
Range("A2").Select
End If


End Sub


Can someone help?

TimT

If statement not working right
 
The problem is column E will not hide when the condition is met.

"TimT" wrote:

I have an if statement that if range name "tax_r" = true then column E should
be hidden.
I believe that there is a problem with my code and I can't see it.

Private Sub Enter_Click()

Worksheets("Intro").Visible = False

Sheet3.Activate
frm_Data.Show vbModeless

Dim TaxType As String
With Worksheets("vlookup")

TaxType = .Range("Tax_r").Value

End With

If TaxType = "TRUE" Then
Columns("E:E").Select
Selection.EntireColumn.Hidden = True
Range("A2").Select
End If


End Sub


Can someone help?


Tom Ogilvy

If statement not working right
 
If TaxType = "TRUE" Then
sheet3.Columns("E:E").Select
Selection.EntireColumn.Hidden = True
Sheet3.Range("A2").Select
End If

--
Regards,
Tom Ogilvy

"TimT" wrote in message
...
I have an if statement that if range name "tax_r" = true then column E

should
be hidden.
I believe that there is a problem with my code and I can't see it.

Private Sub Enter_Click()

Worksheets("Intro").Visible = False

Sheet3.Activate
frm_Data.Show vbModeless

Dim TaxType As String
With Worksheets("vlookup")

TaxType = .Range("Tax_r").Value

End With

If TaxType = "TRUE" Then
Columns("E:E").Select
Selection.EntireColumn.Hidden = True
Range("A2").Select
End If


End Sub


Can someone help?





All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com