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

At least it's making my head spin...

Sheet1 has sections so that A32 - A81 is part of one section. I want to
loop through all the values in Sheet2, column D and if those values begin
with "6" then take the value from the same row in column E and place it in
Sheet1 starting from row A32 and filling downward for every instance in
Sheet2 where the value begins with "6".

Please help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default head spinning loop...

Give this a try...

Sub CopyStuff()
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String

Set rngToSearch = Sheets("Sheet2").Columns("D")
Set rngFound = rngToSearch.Find(What:="6*", _
LookAt:=xlWhole, _
LookIn:=xlFormulas)
If Not rngFound Is Nothing Then
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Offset(0, 1).Copy Sheets("Sheet1").Range("A32")
End If
End Sub
--
HTH...

Jim Thomlinson


"Stephen" wrote:

At least it's making my head spin...

Sheet1 has sections so that A32 - A81 is part of one section. I want to
loop through all the values in Sheet2, column D and if those values begin
with "6" then take the value from the same row in column E and place it in
Sheet1 starting from row A32 and filling downward for every instance in
Sheet2 where the value begins with "6".

Please 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
Cant get my head around this one mbys14932 Excel Worksheet Functions 7 June 9th 06 05:23 PM
I'm over my head on this one... ChuckF Excel Programming 1 April 6th 06 09:11 PM
Insert spinning button with time format in Excel 2000? Pat Hughes Excel Discussion (Misc queries) 5 October 27th 05 12:55 AM
Spinning Numbers Michael[_23_] Excel Programming 1 December 28th 03 11:05 PM
Spinning numbers Michael[_23_] Excel Programming 1 December 24th 03 06:31 AM


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