i want to know how to use a string in VBA to find a worksheet based on the contents of a cell
i thought this would work but cant seemed to figure out what keeps throwng an error
Code:
Private Sub CommandButton1_Click()
Dim shtName As String
Dim rngAddress As String
shtName = Range("b5").Value
rngAddress = Range("c5").Value
Sheets(shtName).Range(rngAddress).Value = Range(b8).Value
End Sub
i thought this would work but cant seemed to figure out what keeps throwng an error
Code:
Private Sub CommandButton1_Click()
Dim shtName As String
Dim rngAddress As String
shtName = Range("b5").Value
rngAddress = Range("c5").Value
Sheets(shtName).Range(rngAddress).Value = Range(b8).Value
End Sub