Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Swap values in userform txtboxes

I have two txtboxes on a userform.
txtheight and txtwidth, I want to add a checkbox that will change the value
of the height box (11) to the value of the width box (14) and vice versa.
In other words, change the two boxes from 11x14 to 14x11.

Thank you
CR


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Swap values in userform txtboxes

Try something like this...

Private Sub CheckBox1_Click()
Dim Temp As String
Temp = txtheight.Value
txtheight.Value = txtwidth.Value
txtwidth.Value = Temp
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
I have two txtboxes on a userform.
txtheight and txtwidth, I want to add a checkbox that will change the
value of the height box (11) to the value of the width box (14) and vice
versa.
In other words, change the two boxes from 11x14 to 14x11.

Thank you
CR


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Swap values in userform txtboxes

Hi,

Assign this code to your checkbox and ti will flip the values when checked -
un-checked,

Private Sub CheckBox1_Click()
If CheckBox1 = True Then
tempval = Txtheight.Text
Txtheight.Text = Txtwidth.Text
Txtwidth.Text = tempval
End If
If CheckBox1 = False Then
tempval = Txtwidth.Text
Txtwidth.Text = Txtheight.Text
Txtheight.Text = tempval
End If
End Sub

Mike

"CR" wrote:

I have two txtboxes on a userform.
txtheight and txtwidth, I want to add a checkbox that will change the value
of the height box (11) to the value of the width box (14) and vice versa.
In other words, change the two boxes from 11x14 to 14x11.

Thank you
CR



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swap values in a stacked bar pivot chart vladi16 Charts and Charting in Excel 1 June 10th 09 07:16 AM
swap values between two cells killdare Excel Worksheet Functions 3 November 26th 07 07:20 AM
There should be a swap function for 2 values Johnny Excel Discussion (Misc queries) 1 July 7th 06 05:56 PM
Swap range values TommySzalapski[_14_] Excel Programming 4 July 27th 05 02:09 PM
Populating txtboxes Dave R.[_2_] Excel Programming 3 April 16th 04 07:02 PM


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"