Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
From my long experience I'd recommend the following wooden method, which
works with the selection - it is obviously most reliable. Though it may be easily re-built to the UsedRange or so. PB Sub CopyInSelect() 'Macro fills up the empty cells in the selection in such a way that it 'copies each non-empty one, beginning with the upper left corner, into the 'following ones, until it hits the next non-empty. Then the same process 'repeats again. If the number of columns in the selection is 'greater or equal to the number of rows, the copying runs from up to down, 'and vice versa from left to right. 'Petr Bezucha, 2002 Dim I As Long, R1 As Long, R2 As Long Dim J As Long, C1 As Long, C2 As Long With Selection R1 = .Row R2 = .Rows.Count C1 = .Column C2 = .Columns.Count End With S = "" If R2 < C2 Then For I = R1 To R2 For J = C1 To C2 GoSub Action Next J Next I Else For J = C1 To C1 + C2 - 1 For I = R1 To R1 + R2 - 1 GoSub Action Next I Next J End If Exit Sub Action: Set C = Cells(I, J) If IsEmpty(C) Then C.Value = S Else S = C.Value End If Return End Sub -- Petr Bezucha "ambr711" wrote: I want Excel to determine if a cell is blank, if yes then copy the cell above, if no then move to the next cell until another blank cell is found and then copy the cell directly above |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Fill function | New Users to Excel | |||
Fill color with if function | Excel Worksheet Functions | |||
Fill function | Excel Worksheet Functions | |||
Fill Function to next Column | Excel Worksheet Functions | |||
I have a list of data, fill in the gaps. FILL function won't work | Excel Discussion (Misc queries) |