Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default equal size columns [same no. of rows]

hello everyone

i want to ask a question tried to slove them but as i m
novice so havnt solved so far

i have data in column1 to n the data in each is of different length/
diff number of rows
are present

i want to make all coulumns are of same size

say if 1 column has data in 15 rows n
another column2 hav data in 6
rows
[so i want to copy data of 6 row in all the rows upto 15] and
some other column hav data in 10 rows ..[so i want to copy data of 6
row in all the coumns upto 15] so want them to make equal length

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default equal size columns [same no. of rows]

non-vba - just drag down the last cell (say, row 6) to where you need
to go (row 15), thereby autofilling.

in vba (untested), something like

sub fill_all_rows()

dim col as integer
dim c as range
dim iLastRow as integer
dim rmyrange as range

set rmyrange = worksheet.range("a1:f15") 'for instance
set col = 1

for each col in rmyrange

do until c.row = 16
for each c in col
if c <"" then
'do nothing
else
c = c.offset(-1,0).value 'might need to be c.value =
c.offset(-1,0).value
end if
next c

next col

end sub


hope it (at least) gets you started!
:)
susan




On May 9, 8:33 am, wrote:
hello everyone

i want to ask a question tried to slove them but as i m
novice so havnt solved so far

i have data in column1 to n the data in each is of different length/
diff number of rows
are present

i want to make all coulumns are of same size

say if 1 column has data in 15 rows n
another column2 hav data in 6
rows
[so i want to copy data of 6 row in all the rows upto 15] and
some other column hav data in 10 rows ..[so i want to copy data of 6
row in all the coumns upto 15] so want them to make equal length



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default equal size columns [same no. of rows]

thanks susan for ur time n quick reply

but actually the code u mentioned woked only in case of 2 columns in
which col1 col2
but in my case many columns are there and

i mean we hav to "redim" the size of our range

i have to compare two adjacent columns and count whichevr have
greater number of rows between two adjacent column then i hav to make
small size column should b equal to longer column

hope i hav made it clear plz let me knw if i havnot frmed it properly

many thanx for ur time n sugeestions



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default equal size columns [same no. of rows]

hi! sorry i didn't get back to you yesterday - i was out sick........
i am still sick today & my brain is not working quite good enough, and
i can't make this stupid thing work.................
i couldn't make 2 "for-each" loops work inside each other, so i made
the 2nd loop into a different sub.
maybe somebody else can help you get it working???
:P
sorry!
susan

'======================
Option Explicit

Sub fill_all_rows()

Dim col As Integer
Dim myCol As Range
Dim c As Range
Dim ic As Integer
Dim iLastRow As Integer
Dim rmyRange As Range
Dim ws As Worksheet

Set ws = ActiveSheet
Set rmyRange = ws.Range("a1:f15") 'for instance

Set myCol = ws.Cells(, 1)

For Each myCol In rmyRange

Call loop_columns

Next myCol

End Sub

'==========================

Sub loop_columns()

Dim col As Integer
Dim myCol As Range
Dim rCell As Range
Dim r As Long
Dim ic As Integer
Dim iLastRow As Integer
Dim rmyRange As Range
Dim ws As Worksheet

ic = 1

For Each rCell In myCol
r = rCell.Row
Do Until r = 16
If rCell < "" Then
'do nothing
Else
rCell = rCell.Offset(-1, 0).Value 'might need to be c.value =
'c.Offset(-1, 0).Value
End If
Loop
Next rCell

End Sub

'========================

On May 9, 1:42 pm, wrote:
thanks susan for ur time n quick reply

but actually the code u mentioned woked only in case of 2 columns in
which col1 col2
but in my case many columns are there and

i mean we hav to "redim" the size of our range

i have to compare two adjacent columns and count whichevr have
greater number of rows between two adjacent column then i hav to make
small size column should b equal to longer column

hope i hav made it clear plz let me knw if i havnot frmed it properly

many thanx for ur time n sugeestions



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
Columns of Equal Size Templar Excel Discussion (Misc queries) 3 October 14th 08 04:02 AM
Zoom size doesn't equal print size vinceh Excel Discussion (Misc queries) 2 August 13th 08 12:03 AM
Hide rows when specified columns equal zero Han123 Excel Discussion (Misc queries) 1 June 7th 08 04:31 AM
Turning rows of equal number of columns into 1 continuous row chimerical Excel Worksheet Functions 1 December 7th 06 09:45 PM
set number of rows equal in mutiple columns speary Excel Discussion (Misc queries) 5 July 8th 05 12:27 AM


All times are GMT +1. The time now is 12:24 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"