VBA: Add Info to a Named Range from a textbox

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
826
Office Version
  1. 365
Platform
  1. Windows
I need a userform that when I enter info in a textbox and click a command button it will add that information to a range named "Grade" this range is located on sheet 1.
Thanks for looking
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Assuming that the scope of the named range is the workbook, try...

Code:
Range("Grade").Value = Me.TextBox1.Value

Change the name of the TextBox, accordingly. If the scope of the named range is the worksheet, you'll need to qualify the referrence for the named range with the name of that worksheet.
 
Upvote 0
Thank you Domenic, I cant seem to get the sheet in the code correctly.
The Range is on a different worksheet.
The Sheet name is "LIST"

I tried this but it did not work..
Private Sub CommandButton1_Click()
Sheet ("List")
Range("Grades").Value = Me.TextBox1.Value
End Sub
 
Upvote 0
Domenic I figured out the correct way to enter it
Private Sub CommandButton1_Click()
Range("List!Grades").Value = Me.TextBox1.Value
End Sub
When I enter "a709"in to the text box it replaces all 20 names in the named range to "a709"
I need it to just be added to that named Range.

Thanks you again !
 
Upvote 0

Forum statistics

Threads
1,216,038
Messages
6,128,447
Members
449,453
Latest member
jayeshw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top