Hi! I'm quite a newbie to VBA macros and I am in urgent need. I created a Userform to save some time with copy and pasting excel content. Now I have the following issue: I get a string output from a Userform - Textbox (txtHRS_ANW). I created exactly the same names as named ranges. Now I want to use the string output as a reference for the named range. I am not able to add the double quotes in the brackets - i tried using """" and chr(34) My code is as follows:
Code:
Private Sub cmdHRSLoading_Click()
Dim NameRange As String
If chkANW = True Then
NameRange = Me.txtHRS_ANW.Value 'gives me following string HRS_ANW_CORP01 (until CORP10 depending on user entry)
Sheet5.Range(NameRange).Select 'here I would like to use the string as a reference for the range
Selection.Copy
Sheet9.Range("A" & Rows.count).End(xlUp).Offset(1).Select
Selection.Paste
End If
End Sub