Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default blank rows filling (Urgent)

Hi,
all

Here is a example.
I have three columns in excel.There are some blank cells and rows.
A B C
SMH SMHP CPR


MDR



SLK
CPD DHG STG
STG



Here is how it should look after filling up the blank columns
Col A Col B Col C
SMH SMHP CPR
SMH SMHP CPR
SMH SMHP MDR
SMH SMHP MDR
SMH SMHP MDR
SMH SMHP SLK
CPD DHG STG
CPD DHG STG


Right now I am doing it manually. Is there a way I can do it by writing some
VBA code or macros

Any help would be highly appreciated?
--
Kittie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default blank rows filling (Urgent)

Try this:

Select your entire data range
<Edit<Go to
Click the [Special Cells] button
Check: Blanks
Click the [OK] button

Then...while those blanks are selected...
Type =
then press the UP ARROW key one time
Then..holding down the [Ctrl] and [Shift] keys...press the [Enter] key

That should cause every blank cell to reflect the first available value
above it.

Note: to "hard code" those values...
Select the entire data range
<Edit<Copy
<Edit<Paste Special
Check: Values
Click the [OK] button

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"Lolly" wrote:

Hi,
all

Here is a example.
I have three columns in excel.There are some blank cells and rows.
A B C
SMH SMHP CPR


MDR



SLK
CPD DHG STG
STG



Here is how it should look after filling up the blank columns
Col A Col B Col C
SMH SMHP CPR
SMH SMHP CPR
SMH SMHP MDR
SMH SMHP MDR
SMH SMHP MDR
SMH SMHP SLK
CPD DHG STG
CPD DHG STG


Right now I am doing it manually. Is there a way I can do it by writing some
VBA code or macros

Any help would be highly appreciated?
--
Kittie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default blank rows filling (Urgent)

Loly,

If you would like to work with macro:

Sub CopyInSelection()

'Macro fills in empty cells in the selection by copying each
'non-empty cell from upper left corner into all succeeding cell
'until coming across the next non-empty one. If the number of
'columns in the selection is greater or equal to the number of
'rows, the filling runs downwards, and vice versa.

'Petr Bezucha, 2005

Dim I As Integer, R1 As Integer, R2 As Integer
Dim J As Integer, C1 As Integer, C2 As Integer

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

Regards
--
Petr Bezucha


Lolly pÃ*Å¡e:

Hi,
all

Here is a example.
I have three columns in excel.There are some blank cells and rows.
A B C
SMH SMHP CPR


MDR



SLK
CPD DHG STG
STG



Here is how it should look after filling up the blank columns
Col A Col B Col C
SMH SMHP CPR
SMH SMHP CPR
SMH SMHP MDR
SMH SMHP MDR
SMH SMHP MDR
SMH SMHP SLK
CPD DHG STG
CPD DHG STG


Right now I am doing it manually. Is there a way I can do it by writing some
VBA code or macros

Any help would be highly appreciated?
--
Kittie

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
Filling in blank rows Jenny B. Excel Discussion (Misc queries) 3 December 18th 06 02:50 PM
Filling In Every Blank Rebecca New Users to Excel 4 June 5th 06 03:50 AM
Filling Blank Cells Pankaj Excel Discussion (Misc queries) 3 June 2nd 05 08:54 PM
Filling in Blank Cells Rebecca New Users to Excel 11 May 16th 05 10:47 PM
Filling Blank Cells test[_6_] Excel Programming 2 October 19th 04 08:53 PM


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