Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill Until


Hi all! I've got this macro in Sheet 1 (attached):

Sub abc()
Set rng = Range(Range("B4"), _
Cells(Rows.Count, 2).End(xlUp))
For Each cell In rng
If Not IsEmpty(cell) And _
InStr(1, cell.Value, "total", _
vbTextCompare) = 0 Then
Range("D3").Copy cell.Offset(0, 2)
End If
Next
End Sub

and it basically autofills all cells in column D from D3 downwards
except for those cells with no corresponding value in the B column and
those with "Total". I would just like to modify the macro such that the
autofill stops once it reaches the F cell whose corresponding column B
cell has a value of "Total Group 2". Anyone know how this can be done?
Any help will be greatly appreciated. Thanks!


+-------------------------------------------------------------------+
|Filename: Sheet 1.JPG |
|Download: http://www.excelforum.com/attachment.php?postid=4028 |
+-------------------------------------------------------------------+

--
uberathlete
------------------------------------------------------------------------
uberathlete's Profile: http://www.excelforum.com/member.php...o&userid=28388
View this thread: http://www.excelforum.com/showthread...hreadid=483891

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Autofill Until

It does that already.

--
Regards,
Tom Ogilvy


"uberathlete"
wrote in message
...

Hi all! I've got this macro in Sheet 1 (attached):

Sub abc()
Set rng = Range(Range("B4"), _
Cells(Rows.Count, 2).End(xlUp))
For Each cell In rng
If Not IsEmpty(cell) And _
InStr(1, cell.Value, "total", _
vbTextCompare) = 0 Then
Range("D3").Copy cell.Offset(0, 2)
End If
Next
End Sub

and it basically autofills all cells in column D from D3 downwards
except for those cells with no corresponding value in the B column and
those with "Total". I would just like to modify the macro such that the
autofill stops once it reaches the F cell whose corresponding column B
cell has a value of "Total Group 2". Anyone know how this can be done?
Any help will be greatly appreciated. Thanks!


+-------------------------------------------------------------------+
|Filename: Sheet 1.JPG |
|Download: http://www.excelforum.com/attachment.php?postid=4028 |
+-------------------------------------------------------------------+

--
uberathlete
------------------------------------------------------------------------
uberathlete's Profile:

http://www.excelforum.com/member.php...o&userid=28388
View this thread: http://www.excelforum.com/showthread...hreadid=483891



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill Until


Hey Tom! Well, assume that in sheet 1, there is a value in B19, say "Al
Groups". The macro autofills all the way down to D19 also. How would
modify this such that it stops right at the F cell with a correspondin
B cell value of "Total Group 2"

--
uberathlet
-----------------------------------------------------------------------
uberathlete's Profile: http://www.excelforum.com/member.php...fo&userid=2838
View this thread: http://www.excelforum.com/showthread.php?threadid=48389

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Autofill Until

Sub abc()
Set rng = Range(Range("B4"), _
Cells(Rows.Count, 2).End(xlUp))
For Each cell In rng
If Not IsEmpty(cell) And _
InStr(1, cell.Value, "total", _
vbTextCompare) = 0 Then
Range("D3").Copy cell.Offset(0, 2)
End if
If Instr(1,cell.Value,"total group 2", _
vbTextCompare) then
exit sub
End If
Next
End Sub

--
Regards,
Tom Ogilvy


"uberathlete"
wrote in message
...

Hey Tom! Well, assume that in sheet 1, there is a value in B19, say "All
Groups". The macro autofills all the way down to D19 also. How would I
modify this such that it stops right at the F cell with a corresponding
B cell value of "Total Group 2"?


--
uberathlete
------------------------------------------------------------------------
uberathlete's Profile:

http://www.excelforum.com/member.php...o&userid=28388
View this thread: http://www.excelforum.com/showthread...hreadid=483891



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill Until


^^ Thank you!! :

--
uberathlet
-----------------------------------------------------------------------
uberathlete's Profile: http://www.excelforum.com/member.php...fo&userid=2838
View this thread: http://www.excelforum.com/showthread.php?threadid=48389

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
autofill stephen Excel Discussion (Misc queries) 1 July 17th 08 08:50 PM
Autofill Dolphinv4 Excel Discussion (Misc queries) 2 October 21st 05 12:34 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM
AutoFill Dave Ramage[_2_] Excel Programming 1 July 29th 03 11:18 AM


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