VB Userform help

hail11

Board Regular
Joined
May 3, 2007
Messages
199
i have a label 5 in my VBA i would like to be able to swich what it says depending on what the linked page has picked
this is what i need

If sheet 9 range a132 = "Y" then sheet 9 range a133
If sheet 9 range a132 = "N" then sheet 9 range a134
If sheet 9 range a132 = "" then sheet 9 range a133



Please help
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi,

Add the following code to the event that drives the label caption change:

Code:
If (Sheets("sheet9").Range("A132").Value = "Y" or _
     Sheets("sheet9").Range("A132").Value = "") then
     Label5.Caption = Sheets("sheet9").Range("A133").Value
Elseif Sheets("sheet9").Range("A132").Value = "N" then
     Label5.Caption = Sheets("sheet9").Range("A134").Value
End If

Ron

EDIT: fixed Code tags - Moderator
 
Upvote 0
i have
Private Sub Label5_Click()
If (Sheets("sheet8").Range("C179").Value = "Y" Or _
Sheets("sheet8").Range("C179").Value = "") Then
Label5.Caption = Sheets("sheet8").Range("B182").Value
ElseIf Sheets("sheet8").Range("C179").Value = "N" Then
Label5.Caption = Sheets("sheet8").Range("B183").Value
End If

End Sub

It brings up a debug error and i just want to look at it not have to click on it
 
Upvote 0
ok i have this
Private Sub userform_Initialize()
Me.Label5.Caption = Worksheets("Sheet8").Range("b184").Value
End Sub

this is what i needed
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,619
Members
449,039
Latest member
Mbone Mathonsi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top