Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro code

Status
Not open for further replies.

math20

MIS
Jul 7, 2005
71
CA
Hi

I am trying to write in a macro a vlookup condition. Basically i would like it to lookup a date match and paste a value.

This is what I have now:
Sheets("INV").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

In the Range I would like to put the condition to find the date from Sheet A cell A3 macth it in Sheets "INV" and paste a Range of Values from Sheet A cell (B2: J2)in Sheet "INV" cell B4:J4

Thank you for your assistance.
 


hi,

Chances are you do not need VBA.

This is probably a simple lookup, that can return a value on the row that corresponds to your lookup value.

On what sheet/column is your lookup range and in what column is the value to return?

In what column in INV are the lookup values you will use in your lookup?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi SkipVought,

Thank you for your prompt reply.

Let me provide a little bit more details for using macro and VBA. This is one of daily task as I run the data in access nad paste it in excel it has values for multiple groups and basically macro is useed to repeat process.

I want it to lookup a date in Sheet called "Data" Column A3 and Macth it with Dates in INV sheet in Column A this sheet has daily date for the month. Then I would like it to paste a range of values from Data sheet Column B5:J5 to INV Sheet corresponding date. I hope I am making sense here. Please forgive my lack of necessary details.
Once again Thank you.
 

Hmmmmm???

You are looking up a date on the data sheet in column A3 You mean column A and want to "paste" values from column B5:J5 You mean column B:J

For any date that you lookup, how many rows of data will there be, or just ONE ROW?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Just one row for each group and I have 6 groups. I am thinking of using this code for each group to do the same.
 

[tt]
B4: [highlight]=VLOOKUP($A4,DATA!B:J,COLUMN(),false)[/highlight]
[/tt]
Paste this formula into INV!B4, where your first lookup date is in A4.

COPY this cell and PASTE in B4:J9 on the INV sheet, assuming that your SIX lookup dates are in A4:A9.




Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 


oops, sorry
[tt]
B4: [highlight]=VLOOKUP($A4,DATA!A:J,COLUMN(),false)[/highlight]
[/tt]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 


and I also missed the absolute referenc on the lookup range
[tt]
=VLOOKUP($A4,DATA!$A:$J,COLUMN(),FALSE)
[/tt]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top