Thread: Fixed Width
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Fixed Width

the VBA string function does exactly what you want it to do. let the
character be " "

Returns a Variant (String) containing a repeating character string of the
length specified.

Syntax

String(number, character)



"Brad" wrote:

Thanks for taking the time to read my question.

I'm working with a fixed width text file. I want to add x number of spaces
after my value without having to do a loop. Is there a good way to do this?

I'm using Print #1, Sheets(SheetName).Cells(RowNum, 1) & " " &
Sheets(SheetName).Cells(RowNum, 2) to write to the file. So I can use
len() to get the len of the value and then just add x spaces to make up the
difference.

Thanks,

Brad