Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vlookup macro pasting


So i've got this forumla "=E3*VLOOKUP(D3,units,2,FALSE)"
I'm using a macro to fill a column in a sheet with that forumla, but I
need E3 and D3 to change as they would if i autofilled down. So they're
looking at the column in the same row as it is.
Any ideas?


Thanks,

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529267

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default vlookup macro pasting

this does what you want. Adjust to match your particulars.

Range("F3:F200").formula = "=E3*VLOOKUP(D3,units,2,FALSE)"

--
Regards,
Tom Ogilvy



"cbh35711" wrote:


So i've got this forumla "=E3*VLOOKUP(D3,units,2,FALSE)"
I'm using a macro to fill a column in a sheet with that forumla, but I
need E3 and D3 to change as they would if i autofilled down. So they're
looking at the column in the same row as it is.
Any ideas?


Thanks,

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529267


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vlookup macro pasting


Hi
When using Vba, take advantage of cells(row,column) to do taks like
this.

I would suggest this code

Dim Ix as long, units as range

set range=sheets("???").range("????")

for Ix = [the first row in the range] to [last row in the range]
cells(Ix,??)=
cells(Ix,5)*worksheetfunction.vlookup(cells(Ix,4), units,2,0)
next Ix


--
jordun
------------------------------------------------------------------------
jordun's Profile: http://www.excelforum.com/member.php...o&userid=33118
View this thread: http://www.excelforum.com/showthread...hreadid=529267

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vlookup macro pasting


Great Tom

Thanks,

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529267

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying and Pasting VLOOKUP/HLOOKUP Formulas DS Excel Discussion (Misc queries) 2 November 20th 08 06:27 PM
MACRO COPY/PASTING GILBERT Excel Discussion (Misc queries) 1 August 31st 06 04:55 AM
macro for pasting CMD Excel Discussion (Misc queries) 2 May 26th 06 10:03 PM
Vlookup and Pasting Dave Peterson Excel Programming 0 February 5th 06 04:22 PM
Pasting Macro wilro85[_10_] Excel Programming 2 December 20th 05 07:07 PM


All times are GMT +1. The time now is 10:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"