Current location: Hot Scripts Forums » Programming Languages » Visual Basic » Using Textboxes in Excel


Using Textboxes in Excel

Reply
  #1 (permalink)  
Old 09-30-09, 06:26 PM
Ofendolph Ofendolph is offline
New Member
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Using Textboxes in Excel

I am trying to set up an Excel file that adjusts the scale of a chart when you change numbers in a textbox. I currently have this code:

Code:
Private Sub TextBox1_Change()
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = TextBox1
.MaximumScale = TextBox2
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
End Sub
The problem is when I start typing it immediately changes the scale, for example if I want to enter "30" it changes as soon as I enter the 3. My question is this: how can I set it so that it does not effect the change until I hit Enter after entering a 2 or 3 digit number?
Thanks.

Last edited by digioz; 10-08-09 at 09:44 AM. Reason: Please use code tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-08-09, 09:45 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,167
Thanks: 3
Thanked 8 Times in 8 Posts
You can't do the routine behind the textbox change event. You will have to use a button to trigger the scaling.

Pete
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks

Tags
excel textbox enter chart


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Database Issue WillUK Database 1 05-07-09 03:58 PM
[SOLVED] Force Excel file to open in Excel and not in Browser plugin. bjorkvar HTML/XHTML/XML 10 07-24-08 01:11 PM
Microsoft Excel Driver Error cancer10 ASP 2 01-23-07 09:52 AM
Importing And EXporting An Excel Dilna ASP.NET 2 05-02-06 05:49 PM
How to load Excel data in VB-textbox or label? Nellie Visual Basic 1 03-15-05 07:44 PM


All times are GMT -5. The time now is 07:09 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.