Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default 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
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
Passing Variables Jeff Excel Discussion (Misc queries) 1 November 4th 05 06:46 PM
Passing variables from one sub to another Yasha Avshalumov Excel Programming 4 August 19th 05 04:52 PM
Passing Variables Paula[_3_] Excel Programming 1 August 23rd 04 06:55 PM
passing variables Squid[_2_] Excel Programming 1 July 27th 04 03:47 AM
Passing Variables Royce[_2_] Excel Programming 1 November 20th 03 02:16 PM


All times are GMT +1. The time now is 11:12 PM.

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

About Us

"It's about Microsoft Excel"