textbox & cell name

buzz71023

Active Member
Joined
May 29, 2011
Messages
295
Office Version
  1. 2016
Platform
  1. Windows
I would like to be able to have a userform define the name of a cell. The formula bar will be disabled/hidden along with being in full screen mode. This will help me from having to take a couple of extra steps in the future.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You can give ranges names like so. Jut adapt it for your needs:
Code:
Range("A1").Name = "some_name"
 
Upvote 0
so if i had multiple textboxes would it be

Code:
Private Sub CommandButton1_Click()
 
TextBox1.Value = Range("A1").Name
TextBox2.Value = Range("B1").Name
 
End Sub

because I am getting a 1004 runtime error ("Application-defined or object defined error") when I try to run it the way I have it
 
Last edited:
Upvote 0
I guess it would help if they were in the correct order.

Code:
Private Sub CommandButton1_Click()
 
Range("A1").Name = TextBox1.Value 
Range("B1").Name = TextBox2.Value
 
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,547
Messages
6,120,139
Members
448,948
Latest member
spamiki

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