Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi guys,
How could the sub below be modified for it to work with for example: text phrases in A1 and A2? (It currently works only with numbers/integers in A1 and A2) Private Sub CommandButton1_Click() Dim x As Integer x = Range("a1").Value Range("a1").Value = Range("a2").Value Range("a2").Value = x End Sub Thanks -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Max,
To operate on text values, change: Dim x As Integer to Dim x As String To operate on numbers or strings: Dim x As variant Incidentally, unless you know that the numeric values to be switche are integers, you would be better advised to dim as Double or Single. --- Regards, Norman "Max" wrote in message ... Hi guys, How could the sub below be modified for it to work with for example: text phrases in A1 and A2? (It currently works only with numbers/integers in A1 and A2) Private Sub CommandButton1_Click() Dim x As Integer x = Range("a1").Value Range("a1").Value = Range("a2").Value Range("a2").Value = x End Sub Thanks -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
use Dim x as Variant
"Max" wrote: Hi guys, How could the sub below be modified for it to work with for example: text phrases in A1 and A2? (It currently works only with numbers/integers in A1 and A2) Private Sub CommandButton1_Click() Dim x As Integer x = Range("a1").Value Range("a1").Value = Range("a2").Value Range("a2").Value = x End Sub Thanks -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Max,
Just declare x as variant. -- HTH Bob Phillips "Max" wrote in message ... Hi guys, How could the sub below be modified for it to work with for example: text phrases in A1 and A2? (It currently works only with numbers/integers in A1 and A2) Private Sub CommandButton1_Click() Dim x As Integer x = Range("a1").Value Range("a1").Value = Range("a2").Value Range("a2").Value = x End Sub Thanks -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the detailed tips, Norman !
Works great .. -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Kassie !
-- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Bob !
What kept you? Busy elsewhere, huh <bg -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't expect to see you in the programming group Max, otherwise I would
have been there <g Bob "Max" wrote in message ... Thanks, Bob ! What kept you? Busy elsewhere, huh <bg -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Searching String for phrases/multiple text strings | Excel Worksheet Functions | |||
How can I swap cells | Excel Discussion (Misc queries) | |||
Use of Text Phrases in Excel Functions | Excel Worksheet Functions | |||
Text Strings Swap | Excel Worksheet Functions | |||
Swap Cells | Excel Discussion (Misc queries) |