Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking User Form Text Box to Spreasheet Cell

Status
Not open for further replies.

cyork

MIS
Apr 4, 2001
34
0
0
CA
Hi,

I have a user form which has several text boxes linked to spreadsheet cells via their Data Control property. The problem I am having is displaying formating in the textbox as it appears on the spreasheet. For example the spreadsheet contains a cell with 45%, in the text box this appears as 0.45.

Thanks,

Chris
 
You may need to get away from the data control property, and do the linking to the spreadsheet cell in a more manual fashion, e.g.

In the userform.activate method:

txtMyPercent = sheets("MySheet").cells("D4").text
(to fill the textbox when the sheet is first loaded)

and have the following additional method:

sub txtMyPercent_change()
on error resume next 'to ignore number conversion error
sheets("MySheet").cells("D4")=val(txtMyPercent)
end sub

which updates the worksheet cell when the user makes changes.
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top