Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default empty cell = above cell

Hi,
I have pivot tables that I need to convert into plain columns. So I copy and
paste the values into a new worksheet. Is there a way that I can (with a
macro) fill in the blank cells with the value located in the cell right
above? Keeping in mind that the cell length will vary...
Thanks in advance!
GĂ©raldine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default empty cell = above cell

Hi Géraldine,

If you need to do this programmatiacally, try :

Sub Tester()
Dim rng As Range

Set rmg = Range("A1:B20") '<<========== CHANGE
With rng
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 _
= "=R[-1]C"
.Value = .Value
End With

End Sub


---
Regards,
Norman



"Kanga" wrote in message
...
Hi,
I have pivot tables that I need to convert into plain columns. So I copy
and
paste the values into a new worksheet. Is there a way that I can (with a
macro) fill in the blank cells with the value located in the cell right
above? Keeping in mind that the cell length will vary...
Thanks in advance!
Géraldine



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default empty cell = above cell

Hi Géraldine,

To avoid problems which would be caused if no blank cells were found or,
alternatively, the range comprised more than 8192 non-contiguous blank cell
areas, an error handler should be used:

:Sub Tester1A()
Dim rng As Range

Set rng = Range("A1:B20") '<<========== CHANGE
With rng
On Error Resume Next
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 _
= "=R[-1]C"
On Error GoTo 0
.Value = .Value
End With

End Sub

Note, also, a typo in my previous response:

Set rmg = Range("A1:B20")


should have been:

Set rng = Range("A1:B20")



---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Géraldine,

If you need to do this programmatiacally, try :

Sub Tester()
Dim rng As Range

Set rmg = Range("A1:B20") '<<========== CHANGE
With rng
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 _
= "=R[-1]C"
.Value = .Value
End With

End Sub


---
Regards,
Norman



"Kanga" wrote in message
...
Hi,
I have pivot tables that I need to convert into plain columns. So I copy
and
paste the values into a new worksheet. Is there a way that I can (with a
macro) fill in the blank cells with the value located in the cell right
above? Keeping in mind that the cell length will vary...
Thanks in advance!
Géraldine





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default empty cell = above cell

Thank you! This was great help you have no idea!
Kanga

"Norman Jones" wrote:

Hi GĂ©raldine,

To avoid problems which would be caused if no blank cells were found or,
alternatively, the range comprised more than 8192 non-contiguous blank cell
areas, an error handler should be used:

:Sub Tester1A()
Dim rng As Range

Set rng = Range("A1:B20") '<<========== CHANGE
With rng
On Error Resume Next
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 _
= "=R[-1]C"
On Error GoTo 0
.Value = .Value
End With

End Sub

Note, also, a typo in my previous response:

Set rmg = Range("A1:B20")


should have been:

Set rng = Range("A1:B20")



---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi GĂ©raldine,

If you need to do this programmatiacally, try :

Sub Tester()
Dim rng As Range

Set rmg = Range("A1:B20") '<<========== CHANGE
With rng
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 _
= "=R[-1]C"
.Value = .Value
End With

End Sub


---
Regards,
Norman



"Kanga" wrote in message
...
Hi,
I have pivot tables that I need to convert into plain columns. So I copy
and
paste the values into a new worksheet. Is there a way that I can (with a
macro) fill in the blank cells with the value located in the cell right
above? Keeping in mind that the cell length will vary...
Thanks in advance!
GĂ©raldine






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
find first empty cell in column and start transpose next row in that cell ali Excel Discussion (Misc queries) 6 July 21st 07 11:55 PM
format a cell with a formula so an empty reference cell shows blan M2 Excel Discussion (Misc queries) 3 November 7th 06 10:42 PM
why a reference to an empty cell is not considered empty Nicoscot Excel Discussion (Misc queries) 10 March 10th 06 05:36 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? Steven Rosenberg Excel Programming 0 August 5th 03 06:10 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? SROSENYC Excel Programming 1 August 5th 03 04:34 AM


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