Hi, I want to refer to a combobox on another sheet. I want to be able to click the cell F5 in and things will happen depending to the combobox value. Is there a way to write this code on another sheet and still get it to work?
Heres my code, it works when I am on the same sheet. The code shall be at sheet2 and now it is in sheet1 (Dagbok). Can it be removed to sheet2?
Heres my code, it works when I am on the same sheet. The code shall be at sheet2 and now it is in sheet1 (Dagbok). Can it be removed to sheet2?
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh2 As Worksheet
Set sh2 = Worksheets("Blad2")
Dim sh1 As Worksheet
Set sh1 = Worksheets("Dagbok")
If Not Application.Intersect(Target, sh1.Range("F5")) Is Nothing And Me.ComboBox1.Value = "Jan" Then
Jan5.Show
sh1.Range("A13:A21").Value = sh2.Range("B34:B43").Value
sh1.Range("B13:B21").Value = sh2.Range("C34:C43").Value
sh1.Range("D13:D21").Value = sh2.Range("E34:E43").Value
End If
End Sub