Activecell value inserted as number

didrby

New Member
Joined
Sep 19, 2003
Messages
18
In a macro, I have a form (Bedding_Tag_Information) that has been filled out with sizes (bti_length, bti_width, and bti_thickness. These are the variables assigned to the numbers keyed into the form. When I click the "Done" button, I want to paste the values into sheet (body) and starting at range (body_poly). I then have a vlookup on the bti_thickness for a calculation. The cells on the sheet (body) are formatted as numbers, but when I use Activecell.Value = bti_thickness, the macro puts the correct number in the cell but changes the format. Then the vlookup returns the #N/A. Any help? Thanks. :rolleyes:
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Andrew's solution will work...

However, you should just explicitly state that you'd like to pass a value from the textbox.

Instead of:
Activecell.Value = bti_thickness

Use:
Activecell.Value = bti_thickness.Value
 
Upvote 0
Aaron Blood said:
Andrew's solution will work...

However, you should just explicitly state that you'd like to pass a value from the textbox.

Instead of:
Activecell.Value = bti_thickness

Use:
Activecell.Value = bti_thickness.Value

Aaron,

The OP said "These are the variables assigned to the numbers keyed into the form."

So I assumed they weren't the TextBoxes.
 
Upvote 0
Perhaps that's a fair assumption.

I think they're referring to textboxes even though they say, "variables".

I guess it is possible someone could create a textbox on a userform and then assign it to a variable:
bti_length = Textbox1

But, if they want to pass it as a value they should still use:
bti_length = Textbox1.Value


Whichever way they meant, I think we got em covered.
 
Upvote 0
Thanks for the help. I an new at VBA and the teminology. It was a text box in the form. I did use the Activecell.Value = bti_thickness.Value and it worked great!
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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