PC Review


Reply
 
 
amboo_radley
Guest
Posts: n/a
 
      20th Nov 2008
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 With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      20th Nov 2008
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 With Quote
 
bhbjk1
Guest
Posts: n/a
 
      21st Nov 2008
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 With Quote
 
Joel
Guest
Posts: n/a
 
      21st Nov 2008
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 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
Re: Making a MsgBox return cell data when search finds different data in an adjacent cell Don Guillett Microsoft Excel Discussion 0 4th Jul 2009 01:37 PM
Data Search =?Utf-8?B?QWlyZml2ZQ==?= Microsoft Excel Misc 3 11th May 2007 01:53 AM
Search through Data =?Utf-8?B?YWR6?= Microsoft Excel New Users 1 5th Oct 2006 07:39 AM
Search and Data Box in Data Access Page Shamas via AccessMonster.com Microsoft Access 4 19th Oct 2005 04:50 PM
Data-bound control- Syncing selected with data search kadams1@ca.ibm.com Microsoft Dot NET Framework Forms 1 3rd Jun 2005 04:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:22 AM.