Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default Filling Blanks only with ABOVE nonBlanks

I have Column A8:A150
A8 = SI-11
A9 Blank
A10 Blank
A11 Blank
A12 = SI-12
A13 Blank
A14 Blank
A15 = SI-13
.......

To acheive what I want - Which is:
A8 = SI-11
A9 = SI-11
A10 =SI-11
A11 =SI-11
A12 = SI-12
A13 =SI-12
A14 =SI-12
A15 = SI-13
.......

When within Excel (No VBA)
I highlight A9:A14, Edit, GoTo, SpecialCells.. Blanks, OK
then with 1st cell highlite (by excel as A9) I arrow-up to A8
and Press Control+Enter -- It works FIne

When I record a Macro to do same
I get A9:A14 = SI-11 << the macro is overwriting my NON-Balank Cells
rather than reproducing from where they start downward to the next Non Blank;
I'm not hoding my mouth right, or What?

My current code:

Set mynewRng = Range("A9:A" & MylrA)
With mynewRng
.SpecialCells(xlCellTypeBlanks).Select
.FormulaR1C1 = "=R[-1]C"
End With


Thanks in advance for any assistance....

Jim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Filling Blanks only with ABOVE nonBlanks

Hi,

Try this VB solution

Sub Fill_EM_UP()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A9:A" & lastrow)
For Each C In MyRange
If C.Value = "" Then
C.Value = C.Offset(-1).Value
End If
Next
End Sub

Mike

"JMay" wrote:

I have Column A8:A150
A8 = SI-11
A9 Blank
A10 Blank
A11 Blank
A12 = SI-12
A13 Blank
A14 Blank
A15 = SI-13
......

To acheive what I want - Which is:
A8 = SI-11
A9 = SI-11
A10 =SI-11
A11 =SI-11
A12 = SI-12
A13 =SI-12
A14 =SI-12
A15 = SI-13
......

When within Excel (No VBA)
I highlight A9:A14, Edit, GoTo, SpecialCells.. Blanks, OK
then with 1st cell highlite (by excel as A9) I arrow-up to A8
and Press Control+Enter -- It works FIne

When I record a Macro to do same
I get A9:A14 = SI-11 << the macro is overwriting my NON-Balank Cells
rather than reproducing from where they start downward to the next Non Blank;
I'm not hoding my mouth right, or What?

My current code:

Set mynewRng = Range("A9:A" & MylrA)
With mynewRng
.SpecialCells(xlCellTypeBlanks).Select
.FormulaR1C1 = "=R[-1]C"
End With


Thanks in advance for any assistance....

Jim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default Filling Blanks only with ABOVE nonBlanks

Thanks Mike, works great..
I guess what I was trying just doesn't work.
Is there a specific reason it doesn't?
Thanks again..
Jim

"Mike H" wrote:

Hi,

Try this VB solution

Sub Fill_EM_UP()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A9:A" & lastrow)
For Each C In MyRange
If C.Value = "" Then
C.Value = C.Offset(-1).Value
End If
Next
End Sub

Mike

"JMay" wrote:

I have Column A8:A150
A8 = SI-11
A9 Blank
A10 Blank
A11 Blank
A12 = SI-12
A13 Blank
A14 Blank
A15 = SI-13
......

To acheive what I want - Which is:
A8 = SI-11
A9 = SI-11
A10 =SI-11
A11 =SI-11
A12 = SI-12
A13 =SI-12
A14 =SI-12
A15 = SI-13
......

When within Excel (No VBA)
I highlight A9:A14, Edit, GoTo, SpecialCells.. Blanks, OK
then with 1st cell highlite (by excel as A9) I arrow-up to A8
and Press Control+Enter -- It works FIne

When I record a Macro to do same
I get A9:A14 = SI-11 << the macro is overwriting my NON-Balank Cells
rather than reproducing from where they start downward to the next Non Blank;
I'm not hoding my mouth right, or What?

My current code:

Set mynewRng = Range("A9:A" & MylrA)
With mynewRng
.SpecialCells(xlCellTypeBlanks).Select
.FormulaR1C1 = "=R[-1]C"
End With


Thanks in advance for any assistance....

Jim

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Filling Blanks only with ABOVE nonBlanks

Hi,

Glad I could help. The reason your method failed is that you selected the
blanks in the range OK but then did nothing with that you applied the formula
not to the selecetd blanks but to the range. To make your method work do this

MylrA = Cells(Rows.Count, "A").End(xlUp).Row
Set mynewRng = Range("A9:A" & MylrA)
mynewRng.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"

In my modified code i apply the formula to the selection and not the range

In practice i wouldn't select at all I'd do this

MylrA = Cells(Rows.Count, "A").End(xlUp).Row
Set mynewRng = Range("A9:A" & MylrA)
mynewRng.SpecialCells(xlCellTypeBlanks).FormulaR1C 1 = "=R[-1]C"

Mike

Mike

"JMay" wrote:

Thanks Mike, works great..
I guess what I was trying just doesn't work.
Is there a specific reason it doesn't?
Thanks again..
Jim

"Mike H" wrote:

Hi,

Try this VB solution

Sub Fill_EM_UP()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A9:A" & lastrow)
For Each C In MyRange
If C.Value = "" Then
C.Value = C.Offset(-1).Value
End If
Next
End Sub

Mike

"JMay" wrote:

I have Column A8:A150
A8 = SI-11
A9 Blank
A10 Blank
A11 Blank
A12 = SI-12
A13 Blank
A14 Blank
A15 = SI-13
......

To acheive what I want - Which is:
A8 = SI-11
A9 = SI-11
A10 =SI-11
A11 =SI-11
A12 = SI-12
A13 =SI-12
A14 =SI-12
A15 = SI-13
......

When within Excel (No VBA)
I highlight A9:A14, Edit, GoTo, SpecialCells.. Blanks, OK
then with 1st cell highlite (by excel as A9) I arrow-up to A8
and Press Control+Enter -- It works FIne

When I record a Macro to do same
I get A9:A14 = SI-11 << the macro is overwriting my NON-Balank Cells
rather than reproducing from where they start downward to the next Non Blank;
I'm not hoding my mouth right, or What?

My current code:

Set mynewRng = Range("A9:A" & MylrA)
With mynewRng
.SpecialCells(xlCellTypeBlanks).Select
.FormulaR1C1 = "=R[-1]C"
End With


Thanks in advance for any assistance....

Jim

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default Filling Blanks only with ABOVE nonBlanks

Mike - This was MOST helpful - I better understand the grass roots answers,
thanks to your offering such a fine explanation. I'm getting there !!!
Jim May

"Mike H" wrote:

Hi,

Glad I could help. The reason your method failed is that you selected the
blanks in the range OK but then did nothing with that you applied the formula
not to the selecetd blanks but to the range. To make your method work do this

MylrA = Cells(Rows.Count, "A").End(xlUp).Row
Set mynewRng = Range("A9:A" & MylrA)
mynewRng.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"

In my modified code i apply the formula to the selection and not the range

In practice i wouldn't select at all I'd do this

MylrA = Cells(Rows.Count, "A").End(xlUp).Row
Set mynewRng = Range("A9:A" & MylrA)
mynewRng.SpecialCells(xlCellTypeBlanks).FormulaR1C 1 = "=R[-1]C"

Mike

Mike

"JMay" wrote:

Thanks Mike, works great..
I guess what I was trying just doesn't work.
Is there a specific reason it doesn't?
Thanks again..
Jim

"Mike H" wrote:

Hi,

Try this VB solution

Sub Fill_EM_UP()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A9:A" & lastrow)
For Each C In MyRange
If C.Value = "" Then
C.Value = C.Offset(-1).Value
End If
Next
End Sub

Mike

"JMay" wrote:

I have Column A8:A150
A8 = SI-11
A9 Blank
A10 Blank
A11 Blank
A12 = SI-12
A13 Blank
A14 Blank
A15 = SI-13
......

To acheive what I want - Which is:
A8 = SI-11
A9 = SI-11
A10 =SI-11
A11 =SI-11
A12 = SI-12
A13 =SI-12
A14 =SI-12
A15 = SI-13
......

When within Excel (No VBA)
I highlight A9:A14, Edit, GoTo, SpecialCells.. Blanks, OK
then with 1st cell highlite (by excel as A9) I arrow-up to A8
and Press Control+Enter -- It works FIne

When I record a Macro to do same
I get A9:A14 = SI-11 << the macro is overwriting my NON-Balank Cells
rather than reproducing from where they start downward to the next Non Blank;
I'm not hoding my mouth right, or What?

My current code:

Set mynewRng = Range("A9:A" & MylrA)
With mynewRng
.SpecialCells(xlCellTypeBlanks).Select
.FormulaR1C1 = "=R[-1]C"
End With


Thanks in advance for any assistance....

Jim



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 blanks PAF Excel Discussion (Misc queries) 3 March 3rd 09 04:07 PM
Filling in the blanks methods? Simon[_2_] Excel Programming 3 July 9th 08 01:54 PM
Filter for blanks - nonblanks problem Paul Excel Discussion (Misc queries) 1 May 9th 06 09:02 PM
Access - Filling Blanks wal50 Excel Worksheet Functions 1 November 30th 04 06:45 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 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"