LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Fill empty cell macro not working

I have a macro that cuts and pastes data from one spreadsheet to another. I
need to fill blank cells with a space (" ") before the paste. I have the
macro posted below.

It works for the ("e40:f43") range but is not working for the ("c40:d43")
range. When I run the macro with the (With ("c40:d43") range) statement, it
does not paste the data at all into the "d" columns, but the "f" columns
paste work fine.

Any ideas?

TIA

With ThisWorkbook
Set wksCopy = .Worksheets("Summary")
Set wksPaste = .Worksheets("Plot_Dominant_Rip_Veg")
End With

With Range("c40:d43", Range("c" &
Rows.Count).End(xlUp)).SpecialCells(xlCellTypeBlan ks)
.FormulaR1C1 = "r1c1"
.Value = " "
.Columns("c").MergeCells = False
End With

With Range("e40:f43", Range("e" &
Rows.Count).End(xlUp)).SpecialCells(xlCellTypeBlan ks)
.FormulaR1C1 = "r1c1"
.Value = " "
.Columns("e").MergeCells = False
End With

Set rngCopy = SetCopyRange(wksCopy, "B5:C5")
Set rngPaste = SetPasteRangeByColumn(wksPaste, "A")
rngCopy.Copy rngPaste

Set rngCopy = SetCopyRange(wksCopy, "C40:D43")
Set rngPaste = SetPasteRangeByColumn(wksPaste, "D")
rngCopy.Copy rngPaste

Set rngCopy = SetCopyRange(wksCopy, "E40:F43")
Set rngPaste = SetPasteRangeByColumn(wksPaste, "F")
rngCopy.Copy rngPaste


With Sheets("Plot_Dominant_Rip_Veg")
LastRow = .Cells(.Rows.Count, "f").End(xlUp).Row

'using the last used cell in column A to get the row to copy
Set RngToCopy = .Cells(.Rows.Count, "A").End(xlUp)

HowManyRows = LastRow - RngToCopy.Row + 1

If HowManyRows 1 Then
RngToCopy.Resize(HowManyRows, 2).FillDown
End If

.Columns("A").MergeCells = False
End With

 
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 empty cells, fill with text from cell above Marketer Excel Worksheet Functions 1 August 27th 07 10:35 PM
Macro Request: Fill in empty cells with previous Filled cell in column Artis Excel Worksheet Functions 2 June 25th 07 08:30 PM
Fill empty cells in a range using the used cell bdmsfan Excel Programming 1 December 6th 06 08:52 AM
Loop to find next empty cell to the right not working. Casey[_84_] Excel Programming 3 May 4th 06 03:16 PM
fill cell value to the next empty row adey v. Excel Discussion (Misc queries) 2 November 15th 05 01:47 AM


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