Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Variable length Space Characters to Variables
How do you pass variable length space to a variable. If I want to pass a
space cwith three spaces, I can do it manually by going: Var = "---" (dashes representing spaces) But what if the space width is variable in length? In this example I need to pass the number three to a variable and then use this to define the space between my quotes that get passed to my Var. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Variable length Space Characters to Variables
var=String(3, "-") regards -- tony h ------------------------------------------------------------------------ tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074 View this thread: http://www.excelforum.com/showthread...hreadid=509596 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Variable length Space Characters to Variables
There is a function called string which takes two arguments. The number of
charachters and the character to repeat. dim myString as String myString = String(3, "-") msgbox myString 'Shows 3 dashes Just as a note I have always disliked the fact that String is both a data type and a function. Who thought of that... -- HTH... Jim Thomlinson "ExcelMonkey" wrote: How do you pass variable length space to a variable. If I want to pass a space cwith three spaces, I can do it manually by going: Var = "---" (dashes representing spaces) But what if the space width is variable in length? In this example I need to pass the number three to a variable and then use this to define the space between my quotes that get passed to my Var. Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Variable length Space Characters to Variables
Figured it out. Thanks
DesiredLenth = 3 SpaceWidth = "" For Y = 1 To DesiredLenth SpaceWidth = SpaceWidth & Chr(32) Next CurrentFormulaNoFunction = Replace(CurrentFormula, AllFunctions(X), SpaceWidth, 1, -1, vbTextCompare) "ExcelMonkey" wrote: How do you pass variable length space to a variable. If I want to pass a space cwith three spaces, I can do it manually by going: Var = "---" (dashes representing spaces) But what if the space width is variable in length? In this example I need to pass the number three to a variable and then use this to define the space between my quotes that get passed to my Var. Thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Variable length Space Characters to Variables
Does this help?
Sub Test() Dim strData As String strData = Space(50) Debug.Print Len(strData) Debug.Print strData & "x" End Sub Robin Hammond www.enhanceddatasystems.com "ExcelMonkey" wrote in message ... How do you pass variable length space to a variable. If I want to pass a space cwith three spaces, I can do it manually by going: Var = "---" (dashes representing spaces) But what if the space width is variable in length? In this example I need to pass the number three to a variable and then use this to define the space between my quotes that get passed to my Var. Thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Variable length Space Characters to Variables
But what if the space width is variable in length?
Just one example: Sub Demo() Dim n, Str n = 10 Str = Space(n) End Sub -- HTH. :) Dana DeLouis Windows XP, Office 2003 "ExcelMonkey" wrote in message ... How do you pass variable length space to a variable. If I want to pass a space cwith three spaces, I can do it manually by going: Var = "---" (dashes representing spaces) But what if the space width is variable in length? In this example I need to pass the number three to a variable and then use this to define the space between my quotes that get passed to my Var. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing Variables | Excel Discussion (Misc queries) | |||
Passing variables from one sub to another | Excel Programming | |||
Passing Variables | Excel Programming | |||
passing variables | Excel Programming | |||
Passing Variables | Excel Programming |