Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Nested loop

Hi,

I want to make a nested loop. Or something to compare the value of
cells.
The first loop will step through all of the cells in column A starting
with "A1".
then the seccond loop will start. This one steps through column B
starting with "B1" until there is an empty cell
If object 1 matches object 2 it will copy the row to the second sheet:

This is what I got until now, second loop (this is the part where I go
trough column B)
in this example I used "123" this could be "obj1" from the first loop.

Public Sub test2()

Dim obj2
Dim d, e As Integer
d = 1
e = 2

Cells(d, e).Select
obj2 = ActiveCell

Do Until obj2 = 123
d = d + 1
Cells(d, e).Select
obj2 = ActiveCell
If obj2 = 123 Then Exit Do
Loop

ActiveCell.EntireRow.Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
Rows("1:1").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown

End Sub

Thanks in advance
--Giel

 
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
nested if based on nested if in seperate sheet. how? scouserabbit Excel Worksheet Functions 5 March 2nd 07 04:03 PM
How would I add a loop for this? [email protected] Excel Discussion (Misc queries) 3 September 18th 06 01:21 PM
Nested Loop Link ashcrusher Excel Worksheet Functions 0 January 13th 06 03:46 AM
Do Loop BobBarker Excel Worksheet Functions 0 August 23rd 05 08:33 PM
Help With Loop Dennis Excel Worksheet Functions 2 February 1st 05 08:04 AM


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