VBA Code

steveautsin99

New Member
Joined
Feb 3, 2011
Messages
27
Hi,

I have a workbook called overlook.xlsx and in sheet1 of this work book I have the data for all my ten teams. Please have a look at just TeamA in this sheet.


Excel Workbook
BCDEF
2Team APlannedOfferedAchieved
3YesterdayParameter1
426-Feb-11Parameter2
5Parameter3
6Current WeekParameter1
719 February to 25 FebruaryParameter2
8Parameter3
9Previous WeekParameter1
1012 February to 18 FebruaryParameter2
11Parameter3
Sheet1



The data for overlook.xlsx is taken from a workbook called metrics.xlsx. Metrics.XLSX has ten sheets for then ten teams. Each sheet in Metrics.XLSX have the data for one team and this data is for the previous 12 months.Now I need a VBA code which would copy the data from metrics .XLSX and paste it in the corresponding team cells in Overlook.xlsx.
For Ex say yesterday was 26-Feb-11
The code should copy the data from row no-163 (Not the entire row only the data that hast to be pasted in overlook.xlsx.
For current week the data from the row no 165
And for previous week data from row no 157 should be copied and pasted in overlook.xlsx.

Please have a look on metrics .xlsx . It is just one sheet .



Excel Workbook
ABCDEFGHIJK
2Nov-10DayPP1OP1AP1PP2PP3OP2OP3AP2AP3
72010December
82011January
92011February
10
11Nov-10DayPP1OP1AP1PP2PP3OP2OP3AP2AP3
15216-Feb-11Monday
15317-Feb-11Tuesday
15418-Feb-11Wednesday
15519-Feb-11Thursday
15620-Feb-11Friday
157WeekWeek 44367,830367,954367,836118123124367,954367,954367,954
15821-Feb-11Saturday
15922-Feb-11Sunday
16023-Feb-11Monday
16124-Feb-11Tuesday
16225-Feb-11Wednesday
16326-Feb-11Thursday
16427-Feb-11Friday
165WeekWeek 44367,830367,954367,836118123124367,954367,954367,954
sheet1


Please help me with a vba code to perform this
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Steve, I don't think you need VBA for this one. VLOOKUP formula should work just fine. Currently your week numbers are the same ie Week 44. You need to make the weeks unique for the VLOOKUP formula. If needed, you can always create a new sheet with each day corresponding to a week number to use in your lookup formula.
 
Upvote 0

Forum statistics

Threads
1,224,617
Messages
6,179,915
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top