#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Data Search

I am new to Visual Basic Programming. I need to write a macro that will
search through a large set of data and labels to find the data I need and
report it into an organized form on another worksheet in the same workbook.
This is a part of what the data looks like:

LA BEL: M_ITEM- 12_REAR_1
Po ints Taken: 1
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 362.3872 362.7 0.7 -0.7 -0.3128 **********


LA BEL: C_ITEM- 12_FRONT_2
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 342.0504 342.5 0.7 -0.7 -0.4496 **********
L: 376.074 342.5


I need the macro to ignore all the text and find the data under the "Actual"
column that has an associated numeric value in the column that is labeled
"#NAME?" and copy that value into a cell on another worksheet. The macro
should continue running until the data ends. Can anyone help me write a
macro that will do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Data Search

I don't know if I got the columns correct. the code looks down column B for
the word Actual. Then starts looking at each row of number until it finds an
empty cell in column B. If it finds an empty cell in column b it again looks
for the work actual beffore looking at the numbers again.

When it looks at the number in column b it checks for data in column D and
if there is data it will copy column D to sheet 2.


Enum FindState
FindActual = 1
FindData = 2
End Enum
Sub ExtractData()

NewRow = 1
With Sheets("Sheet1")
State = FindActual
LastRow = .Range("B" & Rows.Count).End(xlUp).Row
RowCount = 1
State = FindActual
For RowCount = 1 To LastRow

Select Case State
Case FindActual:
If UCase(.Range("B" & RowCount)) = "ACTUAL" Then
State = FindData
End If
Case FindData
If .Range("B" & RowCount) = "" Then
State = FindActual
Else
If .Range("D" & RowCount) < "" Then
Sheets("Sheet2").Range("A" & NewRow) = .Range("D" &
RowCount)
NewRow = NewRow + 1
End If
End If
End Select
Next RowCount
End With
End Sub

"amboo_radley" wrote:

I am new to Visual Basic Programming. I need to write a macro that will
search through a large set of data and labels to find the data I need and
report it into an organized form on another worksheet in the same workbook.
This is a part of what the data looks like:

LA BEL: M_ITEM- 12_REAR_1
Po ints Taken: 1
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 362.3872 362.7 0.7 -0.7 -0.3128 **********


LA BEL: C_ITEM- 12_FRONT_2
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 342.0504 342.5 0.7 -0.7 -0.4496 **********
L: 376.074 342.5


I need the macro to ignore all the text and find the data under the "Actual"
column that has an associated numeric value in the column that is labeled
"#NAME?" and copy that value into a cell on another worksheet. The macro
should continue running until the data ends. Can anyone help me write a
macro that will do this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Data Search

Joel

Would your post below work in my situation?

I am using Visual 6.5

I am trying to get my worksheet to find the match of a number in column SUPC
on workbook 1, in a SUPC column in workbook 2. When it finds that number, I
want to to return the number in Price column of workbook 2 into Cost column
on worksheet 1. I think it would go something like this

Workbook 1
A B C
SUPC LB/CS COST
4773214 LB
4937397 LB


Workbook 2
A B C D E F
SUPC ITEM # SIZE ITEM_DESCRIPTION CS Price
4773214 2911284 LB 12.45
4937397 2611212 LB 12.51

Can anyone help here.

--
Jeff


"Joel" wrote:

I don't know if I got the columns correct. the code looks down column B for
the word Actual. Then starts looking at each row of number until it finds an
empty cell in column B. If it finds an empty cell in column b it again looks
for the work actual beffore looking at the numbers again.

When it looks at the number in column b it checks for data in column D and
if there is data it will copy column D to sheet 2.


Enum FindState
FindActual = 1
FindData = 2
End Enum
Sub ExtractData()

NewRow = 1
With Sheets("Sheet1")
State = FindActual
LastRow = .Range("B" & Rows.Count).End(xlUp).Row
RowCount = 1
State = FindActual
For RowCount = 1 To LastRow

Select Case State
Case FindActual:
If UCase(.Range("B" & RowCount)) = "ACTUAL" Then
State = FindData
End If
Case FindData
If .Range("B" & RowCount) = "" Then
State = FindActual
Else
If .Range("D" & RowCount) < "" Then
Sheets("Sheet2").Range("A" & NewRow) = .Range("D" &
RowCount)
NewRow = NewRow + 1
End If
End If
End Select
Next RowCount
End With
End Sub

"amboo_radley" wrote:

I am new to Visual Basic Programming. I need to write a macro that will
search through a large set of data and labels to find the data I need and
report it into an organized form on another worksheet in the same workbook.
This is a part of what the data looks like:

LA BEL: M_ITEM- 12_REAR_1
Po ints Taken: 1
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 362.3872 362.7 0.7 -0.7 -0.3128 **********


LA BEL: C_ITEM- 12_FRONT_2
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 342.0504 342.5 0.7 -0.7 -0.4496 **********
L: 376.074 342.5


I need the macro to ignore all the text and find the data under the "Actual"
column that has an associated numeric value in the column that is labeled
"#NAME?" and copy that value into a cell on another worksheet. The macro
should continue running until the data ends. Can anyone help me write a
macro that will do this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Data Search

Sub GetPrice()

With Workbooks("Workbook1.xls").Sheets("Sheet1")
RowCount = 1
Do While .Range("A" & RowCount) < ""
SUPC = .Range("A" & RowCount)
With Workbooks("Workbook2.xls").Sheets("Sheet1")
Set c = .Columns("A").Find(what:=SUPC, _
LookIn:=xlValues, lookat:=xlWhole)
End With
If Not c Is Nothing Then
.Range("C" & RowCount) = c.Offset(0, 4)
End If
RowCount = RowCount + 1
Loop
End With
End Sub


"bhbjk1" wrote:

Joel

Would your post below work in my situation?

I am using Visual 6.5

I am trying to get my worksheet to find the match of a number in column SUPC
on workbook 1, in a SUPC column in workbook 2. When it finds that number, I
want to to return the number in Price column of workbook 2 into Cost column
on worksheet 1. I think it would go something like this

Workbook 1
A B C
SUPC LB/CS COST
4773214 LB
4937397 LB


Workbook 2
A B C D E F
SUPC ITEM # SIZE ITEM_DESCRIPTION CS Price
4773214 2911284 LB 12.45
4937397 2611212 LB 12.51

Can anyone help here.

--
Jeff


"Joel" wrote:

I don't know if I got the columns correct. the code looks down column B for
the word Actual. Then starts looking at each row of number until it finds an
empty cell in column B. If it finds an empty cell in column b it again looks
for the work actual beffore looking at the numbers again.

When it looks at the number in column b it checks for data in column D and
if there is data it will copy column D to sheet 2.


Enum FindState
FindActual = 1
FindData = 2
End Enum
Sub ExtractData()

NewRow = 1
With Sheets("Sheet1")
State = FindActual
LastRow = .Range("B" & Rows.Count).End(xlUp).Row
RowCount = 1
State = FindActual
For RowCount = 1 To LastRow

Select Case State
Case FindActual:
If UCase(.Range("B" & RowCount)) = "ACTUAL" Then
State = FindData
End If
Case FindData
If .Range("B" & RowCount) = "" Then
State = FindActual
Else
If .Range("D" & RowCount) < "" Then
Sheets("Sheet2").Range("A" & NewRow) = .Range("D" &
RowCount)
NewRow = NewRow + 1
End If
End If
End Select
Next RowCount
End With
End Sub

"amboo_radley" wrote:

I am new to Visual Basic Programming. I need to write a macro that will
search through a large set of data and labels to find the data I need and
report it into an organized form on another worksheet in the same workbook.
This is a part of what the data looks like:

LA BEL: M_ITEM- 12_REAR_1
Po ints Taken: 1
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 362.3872 362.7 0.7 -0.7 -0.3128 **********


LA BEL: C_ITEM- 12_FRONT_2
Actual Nominal #NAME? #NAME? Dev Out/Tol
Y: 342.0504 342.5 0.7 -0.7 -0.4496 **********
L: 376.074 342.5


I need the macro to ignore all the text and find the data under the "Actual"
column that has an associated numeric value in the column that is labeled
"#NAME?" and copy that value into a cell on another worksheet. The macro
should continue running until the data ends. Can anyone help me write a
macro that will do this?

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
search data? kyoshirou Excel Discussion (Misc queries) 6 June 1st 07 09:34 AM
Data Search Airfive Excel Discussion (Misc queries) 3 May 11th 07 01:53 AM
Data Search Airfive Excel Worksheet Functions 2 November 20th 06 06:43 PM
Search through Data adz New Users to Excel 1 October 5th 06 07:39 AM
Search for data using 'contains' JaB Excel Discussion (Misc queries) 1 November 10th 05 12:47 PM


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