Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help needed with Vlookup & copy row to new sheet

Hi, i have an application where i have two sheets with data on, variable
in number of rows. I need to loop down one in column "A",(Sheet
19_10_06) and check if the number exists in column "A" on the second
sheet (Oct_06), if it is continue to next number. If it is not on the
second sheet then copy entire row and past in new sheet and continue
until end of data in column "A".
The end result being a comparison of numbers in columns "A" of both
sheets and the differences pasted in a new sheet (New gAMS).

Any help would be greatly appreciated.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Help needed with Vlookup & copy row to new sheet

Sub ABC()
Dim sh1 as worksheet, sh2 as worksheet, sh3 as worksheet
Dim rng1 as Range, rng2 as Range
Dim rw as Long, cell as Range
set sh1 = worksheets("19_10_06")
set sh2 = worksheets("Oct_06")
set sh3 = worksheets("gAMS")
rw = 2
set rng1 = sh1.Range(sh1.Cells(2,1),sh1.Cells(2,1).End(xldown ))
set rng2 = sh2.Range(sh2.Cells(2,1),sh2.Cells(2,1).End(xldown ))
for each cell in rng1
if application.countif(rng2,cell.value) = 0 then
cell.EntireRow.copy sh3.cells(rw,1)
rw = rw + 1
end if
Next

End sub

--
Regards,
Tom Ogilvy

"Les Stout" wrote:

Hi, i have an application where i have two sheets with data on, variable
in number of rows. I need to loop down one in column "A",(Sheet
19_10_06) and check if the number exists in column "A" on the second
sheet (Oct_06), if it is continue to next number. If it is not on the
second sheet then copy entire row and past in new sheet and continue
until end of data in column "A".
The end result being a comparison of numbers in columns "A" of both
sheets and the differences pasted in a new sheet (New gAMS).

Any help would be greatly appreciated.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Help needed with Vlookup & copy row to new sheet

Thanks for your reply & help Tom, i am on my way back to South Africa
today so will try it on Monday.

best regards,

Les Stout

Tom Ogilvy wrote:

Sub ABC()
Dim sh1 as worksheet, sh2 as worksheet, sh3 as worksheet
Dim rng1 as Range, rng2 as Range
Dim rw as Long, cell as Range
set sh1 = worksheets("19_10_06")
set sh2 = worksheets("Oct_06")
set sh3 = worksheets("gAMS")
rw = 2
set rng1 = sh1.Range(sh1.Cells(2,1),sh1.Cells(2,1).End(xldown ))
set rng2 = sh2.Range(sh2.Cells(2,1),sh2.Cells(2,1).End(xldown ))
for each cell in rng1
if application.countif(rng2,cell.value) = 0 then
cell.EntireRow.copy sh3.cells(rw,1)
rw = rw + 1
end if
Next

End sub

--
Regards,
Tom Ogilvy

"Les Stout" wrote:

Hi, i have an application where i have two sheets with data on, variable
in number of rows. I need to loop down one in column "A",(Sheet
19_10_06) and check if the number exists in column "A" on the second
sheet (Oct_06), if it is continue to next number. If it is not on the
second sheet then copy entire row and past in new sheet and continue
until end of data in column "A".
The end result being a comparison of numbers in columns "A" of both
sheets and the differences pasted in a new sheet (New gAMS).

Any help would be greatly appreciated.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


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
VLOOKUP Help Needed blucajun Excel Discussion (Misc queries) 3 December 11th 08 03:48 AM
VLOOKUP help needed.!! RickJB Excel Worksheet Functions 3 May 21st 08 12:26 PM
VBA and use vlookup from one sheet to copy data from another sheet sverre Excel Programming 0 August 9th 06 02:21 PM
vlookup vs. if, help needed CraigSA Excel Worksheet Functions 7 May 18th 06 11:19 AM
vlookup help needed Steven J Excel Worksheet Functions 5 August 26th 05 10:32 AM


All times are GMT +1. The time now is 05:35 PM.

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"