PC Review


Reply
Thread Tools Rate Thread

Data Extract and Sort Macro Help

 
 
joecrabtree
Guest
Posts: n/a
 
      7th Dec 2006
To all,

Part of my macro is showed below, it opens up a file and then searches
column A, and copies the row if it matches a certain criteria, i.e. if
the cell = FR 2096799. However sometimes the cell is FR2096799 -
without the space, or just 2096799. How can i modify it to search for
all cells in column A that 'CONTAIN' the number 2096799, not EQUAL
2096799.

Any help would be appreciated.

Kind Regards

Joseph Crabtree




Dim wbd As Workbook
Dim wsd As Worksheet
Dim wbs As Workbook
Dim wss As Worksheet


Dim row_d As Long
Dim row_s As Long


Set wbd = ThisWorkbook
Set wsd = wbd.Worksheets("DATA")


Set wbs = Workbooks.Open("C:\TESTMECH.xls", , True)
Set wss = wbs.Worksheets("compiled results")


row_d = 2
row_s = 1


Do
If UCase(wss.Cells(row_s, 3)) = "FR 2096799" Then
wss.Rows(row_s).Copy wsd.Rows(row_d)
row_d = row_d + 1
End If
row_s = row_s + 1
Loop While row_s < 65536




wbs.Close False
Set wss = Nothing
Set wbs = Nothing
Set wsd = Nothing
Set wbd = Nothing

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      7th Dec 2006
Use this idea. For multiples, look in the VBA help index for FINDNEXT. There
is a good example that will easily solve your problem

Sub findpartialnumberincol()
x = Columns(7).Find(222, lookat:=xlPart).Row
MsgBox x
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"joecrabtree" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> To all,
>
> Part of my macro is showed below, it opens up a file and then searches
> column A, and copies the row if it matches a certain criteria, i.e. if
> the cell = FR 2096799. However sometimes the cell is FR2096799 -
> without the space, or just 2096799. How can i modify it to search for
> all cells in column A that 'CONTAIN' the number 2096799, not EQUAL
> 2096799.
>
> Any help would be appreciated.
>
> Kind Regards
>
> Joseph Crabtree
>
>
>
>
> Dim wbd As Workbook
> Dim wsd As Worksheet
> Dim wbs As Workbook
> Dim wss As Worksheet
>
>
> Dim row_d As Long
> Dim row_s As Long
>
>
> Set wbd = ThisWorkbook
> Set wsd = wbd.Worksheets("DATA")
>
>
> Set wbs = Workbooks.Open("C:\TESTMECH.xls", , True)
> Set wss = wbs.Worksheets("compiled results")
>
>
> row_d = 2
> row_s = 1
>
>
> Do
> If UCase(wss.Cells(row_s, 3)) = "FR 2096799" Then
> wss.Rows(row_s).Copy wsd.Rows(row_d)
> row_d = row_d + 1
> End If
> row_s = row_s + 1
> Loop While row_s < 65536
>
>
>
>
> wbs.Close False
> Set wss = Nothing
> Set wbs = Nothing
> Set wsd = Nothing
> Set wbd = Nothing
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort and Extract Macro joecrabtree Microsoft Excel Programming 1 24th Apr 2008 05:09 PM
Sort and Extract Macro joecrabtree Microsoft Excel Programming 0 24th Apr 2008 03:58 PM
Data Extract and sort joecrabtree Microsoft Excel Programming 0 20th Nov 2006 03:56 PM
Please help me sort then extract the data to new workbooks tahrah Microsoft Excel Programming 7 13th Nov 2006 08:29 PM
extract data after sort =?Utf-8?B?U29keQ==?= Microsoft Excel Programming 0 17th Jul 2006 11:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:25 AM.