Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Loop with dynamic range

Never mind, I misunderstood your description of what you wanted filled in.

the code could be easily fixed, but your happy with the looping approach, so
no sense in it.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Your sample code was working in column C, but your later post and the
original talk about column B. It it is actually column B:

Sub FillInData()
Dim rng As Range, rng1 As Range
Dim rng4 As Range, rng2 As Range
With Worksheets("Profile")
Set rng4 = .Cells(1, 2)
If IsEmpty(rng4) Then _
Set rng4 = rng4.End(xlDown)
Set rng = .Range(rng4, _
.Cells(Rows.Count, 2).End(xlUp))
End With
Set rng1 = rng.Offset(0, -1)
On Error Resume Next
Set rng2 = rng1.SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng2 Is Nothing Then
rng2.Formula = "=" & rng2(1).Offset(-1, 0).Address(0, 0)
rng1.Formula = rng1.Value
End If
End Sub

--
Regards,
Tom Ogilvy


"mthomas" wrote in
message ...

Thanks Tom so much for your reply. I'm getting the following error
message:

"Application-defined or Object-defined error"

The line of code is:

rng2.Formula = "=" & rng2(1).Offset(-1, 0).Address(0, 0)


Thanks again for everything!


--
mthomas
------------------------------------------------------------------------
mthomas's Profile:

http://www.excelforum.com/member.php...o&userid=25649
View this thread:

http://www.excelforum.com/showthread...hreadid=486450





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
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
copying dynamic range based on cell outside of range xcelelder Excel Programming 3 September 29th 05 05:08 PM
select dynamic range with dynamic start point Juli Excel Programming 1 August 31st 05 12:05 AM
Excel 2000 VBA - Set Print Range in dynamic range sub_pop[_5_] Excel Programming 2 July 27th 04 08:01 PM
Dynamic execution of a loop Jeroen Kluytmans Excel Programming 1 February 23rd 04 04:09 PM


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