Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jones
 
Posts: n/a
Default Inserting blanks or changing dimensions

I have a list, i.e. a one dimensional array, of numbers. I want to
insert 9 blanks between each cell that has a number in it. Is there a
simple way to do this? Or in the alternative, is there an easy way to
convert a two dimensional array into a one dimensional array (that is,
for my purposes, to insert a 9 blank rows below my one dimensional
array of data & then convert it to a one dimensional array, thereby
leaving nine blanks between each filled cell)?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student
 
Posts: n/a
Default Inserting blanks or changing dimensions

Let's say we have data in column A. It does not matter if the data is
contiguous or not. The following small macro will:

1. gather the data in column A
2. clear column A
3. re-enter the data with fixed spacing


Sub space_it()
Dim l As Long
Dim a(7000)
Dim r As Range

Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
k = 1

For i = 1 To nLastRow
If IsEmpty(Cells(i, 1).Value) Then
Else
a(k) = Cells(i, 1).Value
k = k + 1
End If
Next

Columns("A:A").Clear

For i = 1 To k
j = 10 * i - 9
Cells(j, 1).Value = a(i)
Next

End Sub
--
Gary''s Student


"Jones" wrote:

I have a list, i.e. a one dimensional array, of numbers. I want to
insert 9 blanks between each cell that has a number in it. Is there a
simple way to do this? Or in the alternative, is there an easy way to
convert a two dimensional array into a one dimensional array (that is,
for my purposes, to insert a 9 blank rows below my one dimensional
array of data & then convert it to a one dimensional array, thereby
leaving nine blanks between each filled cell)?


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
font size auto changing from 11 to 15.5 when inserting a symbol Deb in KC Excel Discussion (Misc queries) 0 March 16th 06 07:10 PM
Weighed Average of a weiged average when there are blanks krl - ExcelForums.com Excel Discussion (Misc queries) 1 July 6th 05 07:37 PM
Weighed average if the adjecent column contains blanks Kasimir Lehväsl Excel Discussion (Misc queries) 2 July 4th 05 10:12 PM
linking files with blanks muscogee Excel Discussion (Misc queries) 0 March 17th 05 07:13 PM
Filling in blanks. S. Kissing Excel Worksheet Functions 2 November 24th 04 09:29 PM


All times are GMT +1. The time now is 10:28 AM.

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"