Fordraiders
asked on
Finding a value from a variable on a sheet and marking a Column
Excel 2003
vba routine needed
I have some code that sorts a sheet based another sheets value.
What I have:
A sheet Named "List"
A sheet Named "Sheet2"
some code...
Sheets("Sheet2").Activate
c = Sheets("Sheet2").Range("K1 ").Value
w = Sheets("Sheet2").Range("L1 ").Value
If c = "SKU" Then
Sheets("List").Activate
Cells.Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom , _
DataOption1:=xlSortNormal
End If
If c = "MFRNUM" Then
Sheets("List").Activate
Cells.Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom , _
DataOption1:=xlSortNormal
End If
What I need:
on Sheet "List" there are several columns.
I need to use the variable "w" from Sheet2
Look in Column E on Sheet "List"
If the Value "w" Exists mark Column Q on SHEET "List" with the word "Yes" for that row.
Example:
w = "Toyota"
A .... E ..... Q
121 FORD
32A TOYOTA YES
342 TOYOTA YES
212 TOYOTA CARS YES
RR4 CHEVY
EE3 SATURN
RR1 TOYOTAS YES
So Once it finds and marks the Q column..
I need to sort Sheet "List" first Descending in Column Q and then BY THE CODE ABOVE depending on what "c" is
If c = "Sku"
THE RESULT WOULD BE
A E ..... Q
212 TOYOTA CARS YES
32A TOYOTA YES
342 TOYOTA YES
RR1 TOYOTAS YES
121 FORD
EE3 SATURN
RR4 CHEVY
Thanks
fordraiders
vba routine needed
I have some code that sorts a sheet based another sheets value.
What I have:
A sheet Named "List"
A sheet Named "Sheet2"
some code...
Sheets("Sheet2").Activate
c = Sheets("Sheet2").Range("K1
w = Sheets("Sheet2").Range("L1
If c = "SKU" Then
Sheets("List").Activate
Cells.Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
DataOption1:=xlSortNormal
End If
If c = "MFRNUM" Then
Sheets("List").Activate
Cells.Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
DataOption1:=xlSortNormal
End If
What I need:
on Sheet "List" there are several columns.
I need to use the variable "w" from Sheet2
Look in Column E on Sheet "List"
If the Value "w" Exists mark Column Q on SHEET "List" with the word "Yes" for that row.
Example:
w = "Toyota"
A .... E ..... Q
121 FORD
32A TOYOTA YES
342 TOYOTA YES
212 TOYOTA CARS YES
RR4 CHEVY
EE3 SATURN
RR1 TOYOTAS YES
So Once it finds and marks the Q column..
I need to sort Sheet "List" first Descending in Column Q and then BY THE CODE ABOVE depending on what "c" is
If c = "Sku"
THE RESULT WOULD BE
A E ..... Q
212 TOYOTA CARS YES
32A TOYOTA YES
342 TOYOTA YES
RR1 TOYOTAS YES
121 FORD
EE3 SATURN
RR4 CHEVY
Thanks
fordraiders
Post a workbook perhaps?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
davy2270, Still checking sorry
ASKER
Thanks