
Originally Posted by
AlphaFrog
My guess is that you don't have an ActiveX-type textbox named
Textbox6 on the Quote sheet.
- Double-check the exact name of the textbox.
- There are two types of textboxes; an ActiveX-type and a Forms-type. If you used a Form-type control, try this syntax.
If Target.Value = "Good Faith Estimate" Then Sheets("Quote").TextBoxes("Text Box 6").Text = Sheets("Wages & Rates").Range("J16").Value
If Target.Value = "Lump Sum Quote" Then Sheets("Quote").TextBoxes("Text Box 6").Text = Sheets("Wages & Rates").Range("J18").Value
Exellent! It worked! I just had to change ("Text Box 6") in your code to ("TextBox6") as you suggested and it worked great! Thank you so much.
I have another question that i can start for another thread for if you think i should but it still pretains to this code. How can this code be used if i have the sheets all protected? This workbook has many protected cells with formulas. Employees are meant to use this and be able to use the macros and edit cells that arent locked.
I dont know how to invorporate this yet:
SheetName.Unprotect Password:=yourPassword
And this at the end:
SheetName.Protect Password:=yourPassword
The 2 seperate codes below work but i do not like the way the .Unprotect and .Protect feature works.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
'My Script
If Not Intersect(Target, Range("C2")) Is Nothing Then
If Target.Value = "Good Faith Estimate" Then Sheets("Quote").TextBoxes("TextBox6").Text = Sheets("Wages & Rates").Range("J16").Value
If Target.Value = "Lump Sum Quote" Then Sheets("Quote").TextBoxes("TextBox6").Text = Sheets("Wages & Rates").Range("J18").Value
End If
'Different script
If Target.Address <> "$C$3" Then Exit Sub
If Target.Count > 1 Then Exit Sub
Dim wsI As Worksheet, wsQ As Worksheet, x As Long
'limit change monitoring to C3
Set wsI = Sheets("Input")
Set wsQ = Sheets("Quote")
x = Target.Value * 17
With wsI
.Unprotect
.Rows("8:1027").Hidden = True
If x > 0 Then .Cells(8, 1).Resize(x).EntireRow.Hidden = False
.Protect
End With
With wsQ
.Unprotect
.Rows("9:1028").Hidden = True
If x > 0 Then .Cells(9, 1).Resize(x).EntireRow.Hidden = False
.Protect
End With
Application.ScreenUpdating = True
End Sub
Bookmarks