Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default find range and fill down

range starts at c25.
need to find last cell used in column c.
highlight/select all cells in between. = range
fill down any empty spaces with value from cell above (within range)

(list/data will be incomplete. need to fill in empty spaces only
within used range down, but not to extend past last used cell).

thanx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find range and fill down


Very Easy

Sub fillin()

LastRow = Range("C" & Rows.Count).End(xlUp).Row

OldData = Range("C25")
For RowCount = 26 To LastRow
If Range("C" & RowCount) = "" Then
Range("C" & RowCount) = OldData
Else
OldData = Range("C" & RowCount)
End If
Next RowCount
End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=179831

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default find range and fill down

This macro should execute quicker...

Sub FillInTheBlanks()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Range("C25").Resize(LastRow). _
SpecialCells(xlCellTypeBlanks).Areas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub

--
Rick (MVP - Excel)


"joel" wrote in message
...

Very Easy

Sub fillin()

LastRow = Range("C" & Rows.Count).End(xlUp).Row

OldData = Range("C25")
For RowCount = 26 To LastRow
If Range("C" & RowCount) = "" Then
Range("C" & RowCount) = OldData
Else
OldData = Range("C" & RowCount)
End If
Next RowCount
End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=179831

Microsoft Office Help


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find range and fill down


Rick : Your code may not work in this situation. I think the person has
an ID in column a but no in every row so your code copies the same ID
down the entire worksheet. For example


Row Column A
1 Apple
2
3
4
5
6 Bananna
7
8
9
10
11 Pear
12
13
14
15 Grape


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=179831

Microsoft Office Help

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 199
Default find range and fill down

Another one.

Sub fillinblank()
Dim startrow As Long, i As Long
Dim Lastcell As Range, Blankrng As Range

startrow = 25
Set Lastcell = Cells(Rows.Count, "C").End(xlUp)
Set Blankrng = Range(Cells(startrow, "C"), Lastcell) _
.SpecialCells(xlCellTypeBlanks)

For i = 1 To Blankrng.Areas.Count
Blankrng.Areas(i) = Blankrng.Areas(i).Resize(1, 1).Offset(-1).Value
Next

End Sub

Keiji

J.W. Aldridge wrote:
range starts at c25.
need to find last cell used in column c.
highlight/select all cells in between. = range
fill down any empty spaces with value from cell above (within range)

(list/data will be incomplete. need to fill in empty spaces only
within used range down, but not to extend past last used cell).

thanx



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default find range and fill down

For the most part, my macro does exactly what your macro does; however, as
written, it copies down to the end of the UsedRange for the worksheet. The
following minor modification makes my macro duplicate the results of your
macro...

Sub FillInTheBlanks()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Intersect(Rows("25:" & LastRow), Range("C25"). _
Resize(LastRow).SpecialCells(xlCellTypeBlanks)).Ar eas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub

Because it is handling empty Areas at a time, this should still be faster
than iterating each individual cell (unless there is no groupings of empty
cells, that is, unless each empty cell stands alone).

--
Rick (MVP - Excel)


"joel" wrote in message
...

Rick : Your code may not work in this situation. I think the person has
an ID in column a but no in every row so your code copies the same ID
down the entire worksheet. For example


Row Column A
1 Apple
2
3
4
5
6 Bananna
7
8
9
10
11 Pear
12
13
14
15 Grape


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=179831

Microsoft Office Help


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
Where to find pattern fill add-in NonTechie Charts and Charting in Excel 12 October 26th 09 03:06 PM
Where to find pattern fill add-in NonTechie Excel Discussion (Misc queries) 2 October 16th 09 11:33 AM
SumIf - when I fill down the Range, Criteria & sum range changes markholt Excel Worksheet Functions 3 October 28th 08 12:37 AM
Find non blank cell in range and fill the rest with that value LuisE Excel Programming 1 August 26th 08 07:57 PM
Clear if "#N/A" and Find End of Range, Fill Blanks ryguy7272 Excel Programming 4 July 23rd 08 01:36 PM


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