I'm quite a newbie to VBA macros. 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:
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
Sheet5.activateand next call.selectline. Please remember that you don't need to select to trigger.copy >> .pastemethods