Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default identifying and moving matching values

Hi,
I need to read through the file belowidentify those records that have a
matching code and balance and move them to a second spreadsheet.

The moving isn't a problem but how do I filter based on the match as
given?

If I should read through the code how would I set the variables to
check
for?
Also if I use a loop how will I know when it has finished?

Many thanks

sean
Code--- Buy/Sell--------Currency-- Balance--
AA001--Buyer---------------USD------"33,790"--
AA001--Seller--------------- USD------"33,790"--
AA002--Buyer---------------AUD------"773,490"--
AA002--Seller--------------- AUD------"773,490"--
AA003--Buyer---------------CAD------"7,616,750"--
AA004--Buyer---------------DKK------"576,770"--
AA005--Buyer---------------USD------"24,090,430"--
AA005--Seller--------------- USD------"24,090,430"--
AA006--Buyer---------------EUR------"468,126,330"--
AA006--Seller--------------- EUR---- "468,126,330"--
AA007--Buyer---------------HKD------"10,000"--
AA008--Buyer---------------JPY------"2,435,917,410"--
AA008--Seller--------------- JPY------"2,435,917,410"--
AA009--Buyer---------------MXN------"1,002,670"--
AA009--Seller--------------- MXN------"1,002,670"--
--------- Seller--------------- CAD------"7,616,750"--
--------- Seller--------------- DKK------"576,770"--
--------- Seller--------------- HKD------"10,000"--

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default identifying and moving matching values

The code below is intended to pick out the matching pairs and color
them blue. However it seems to act at random.
Anyone have any suggestions. As to how to find cells that are identical
and in adjacent rows I would be very grateful.

Sub matching()
Dim lastrow As Long
lastrow = Cells(65536, 1).End(xlUp).Row


For i = 2 To lastrow
If Cells(i, 1).Value = Cells(i - 1, 1).Value And Cells(i, 4).Value =
Cells(i - 1, 4) Then
Cells(i, 1).Resize(2, 5).Font.ColorIndex = 11
Cells(i - 1, 1).Resize(2, 5).Font.ColorIndex = 11
End If
Next i


End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default identifying and moving matching values

The code below is intended to pick out the matching pairs and color
them blue. However it seems to act at random.
Anyone have any suggestions. As to how to find cells that are identical
and in adjacent rows I would be very grateful.

Sub matching()
Dim lastrow As Long
lastrow = Cells(65536, 1).End(xlUp).Row


For i = 2 To lastrow
If Cells(i, 1).Value = Cells(i - 1, 1).Value And Cells(i, 4).Value =
Cells(i - 1, 4) Then
Cells(i, 1).Resize(2, 5).Font.ColorIndex = 11
Cells(i - 1, 1).Resize(2, 5).Font.ColorIndex = 11
End If
Next i


End Sub

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
Help with Matching Text Fields - Then Moving the Matching Cells Side by Side [email protected] Excel Discussion (Misc queries) 2 June 11th 07 02:38 PM
Matching and Moving Data From One Spreadsheet to Another? [email protected] Excel Discussion (Misc queries) 1 March 18th 06 02:21 PM
Matching and Moving Data From One Spreadsheet to Another? [email protected] Excel Programming 1 March 18th 06 02:21 PM
Matching and Moving Data From One Spreadsheet to Another? [email protected] Excel Discussion (Misc queries) 1 March 18th 06 01:18 PM
Matching and Moving Data From One Spreadsheet to Another? [email protected] Excel Programming 1 March 18th 06 01:18 PM


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