Macro to insert formula iin column

J

Juan

HI,
I have the following set up
ColK ColL ColM Col S
Week 6 Week 7 Week 8 up to week 13 I'm summing all weeks

Every week, I'm inserting a Vlookup. Is there a way I can do this with a
macro?
Since i'm summing all weeks, I can't copy the vlookup to next column.
The vlookup will always be in Specific week column row2. I have to insert the
vlookup in a few sheets, so trying to see if there is a faster way than
doing
this manually.

Hope I'm making sense.
ANy help wold be really appreciated.
Thanks,
Juan
 
O

OssieMac

Hi Juan,

Could you post a copy of your vlookup formula for say week 7 and then again
for week 8. It will be easier to work out what needs to be done when can see
what changes are required.

To copy the formula to the post.
Select the cell with the formula.
Highlight the formula in the formula bar.
Ctrl/c to copy
Press Enter (ensure you do this Ctrl/c )
Paste the formula into the post.

Also what sheet name and range is the formula in for week 7 and then again
for week 8.
 
J

Juan

Hello Ossie,
thanks. here's the Vlookup and this will be in all weeks.
=VLOOKUP($C:$C,[StatServer.xls]Final!$A:$D,3,0)
When I'm done with that week, I just remove the Vlookup. So everyweek, I need
to reenter the VLOOKUP. Looking for a faster/easier way. I have a few sheets
that
I have to enter similar Vlookup.

Hope this makes sense.
appreciate any help you can provide
thanks,
Juan
 
J

Juan

Hello Ossie,
here's what i came up with:
Sub test()
Dim firstrow As Long
With ActiveSheet

firstrow = 2
Range(Application.InputBox("enter column") & firstrow).Select
Selection.Value = "=VLOOKUP($C:$C,[StatServer.xls]Final!$A:$D,3,0)"
End With
End Sub

This seems to be ok. I can run the macro every week and will put the formula
in the week I need. But appreciate if you have another idea. Is good to
always have more than one way of doing things.
Thanks,
Juan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top