Activecell value inserted as number :: MrExcel Message Board


 FAQFAQ
   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   StatisticsStatistics 
 RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Online StoreOnline Store

MrExcel Message Board Forum Index -> Excel Questions

Activecell value inserted as number
Post new topic   Reply to topic
Last Thread | Next Thread  >   Printable version
  Author    Thread

didrby
Welcome to the Board


Joined: 19 Sep 2003
Posts: 5

Flag: Usa

Status: Offline

 Reply with quote  

Activecell value inserted as number

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. icon_help.gif

Post Fri Sep 19, 2003 12:43 pm 
 View user's profile Send private message

Andrew Poulsom
MrExcel MVP


Joined: 22 Jul 2002
Posts: 8266

Flag: Uk

Status: Offline

 Reply with quote  

Re: Activecell value inserted as number

Try:

Activecell.Value = Val(bti_thickness)

It's probably a string from a TextBox.

Post Fri Sep 19, 2003 12:55 pm 
 View user's profile Send private message

Aaron Blood
Board Master


Joined: 11 Oct 2002
Posts: 149
Location: West Palm Beach, Florida

Status: Offline

 Reply with quote  

Re: Activecell value inserted as number

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

Post Fri Sep 19, 2003 1:46 pm 
 View user's profile Send private message Send e-mail Visit poster's website

Andrew Poulsom
MrExcel MVP


Joined: 22 Jul 2002
Posts: 8266

Flag: Uk

Status: Offline

 Reply with quote  

Re: Activecell value inserted as number

quote:
Originally posted by Aaron Blood:
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.

Post Fri Sep 19, 2003 1:56 pm 
 View user's profile Send private message

Aaron Blood
Board Master


Joined: 11 Oct 2002
Posts: 149
Location: West Palm Beach, Florida

Status: Offline

 Reply with quote  

Re: Activecell value inserted as number

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.

Post Fri Sep 19, 2003 3:21 pm 
 View user's profile Send private message Send e-mail Visit poster's website

didrby
Welcome to the Board


Joined: 19 Sep 2003
Posts: 5

Flag: Usa

Status: Offline

 Reply with quote  

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!

Post Fri Sep 19, 2003 4:40 pm 
 View user's profile Send private message
  Display posts from previous:      

MrExcel Message Board Forum Index -> Excel Questions


Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 1



Add To Favorites

 


Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB: 2.0.4 © 2001 phpBB Group

Need help posting your first question? Read how to post

Need extra help ? Couldn't get the answer you needed ? Get a free quote from our Consulting Team

Download Colo's HTML Maker utility for displaying your Excel Worksheet on the board.

Download VB HTML Maker to post your code on the board


Check out our new index to 485 Excel Articles.


Return to MrExcel Consulting

All contents Copyright 1998-2004 by MrExcel.com
If you believe information posted here is from your copyrighted source, notify us per the Terms of Use
Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.