Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Sal
 
Posts: n/a
Default Copy a formula down in a macro

I have information in column A and I wish to write a macro that:

1. Populates cell B2 with a VLOOKUP formula
2. The macro is then to copy the above formula down to the last active cell
in column A

I have tried so many things that I am in a bid of a muddle. Any suggestions
will be very welcome.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
mudraker
 
Posts: n/a
Default Copy a formula down in a macro


Just modify the formula to equal your lookup formula

Sub Macro1()

Dim LastRow As Long
LastRow = Cells(Rows.Count, "a").End(xlUp).Row
Range("a1").Value = "=b1+1"
Range("a1:a1").AutoFill _
Destination:=Range("A1:A" & LastRow), Type:=xlFillDefault
End Sub


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=548381

  #3   Report Post  
Posted to microsoft.public.excel.misc
Sal
 
Posts: n/a
Default Copy a formula down in a macro

Thank you so much - I just changed the cell references around a wee bit and
it works perfectly.

Your help is much appreciated!!

"mudraker" wrote:


Just modify the formula to equal your lookup formula

Sub Macro1()

Dim LastRow As Long
LastRow = Cells(Rows.Count, "a").End(xlUp).Row
Range("a1").Value = "=b1+1"
Range("a1:a1").AutoFill _
Destination:=Range("A1:A" & LastRow), Type:=xlFillDefault
End Sub


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=548381


  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Copy a formula down in a macro

dim LastRow as long
with worksheets("sheet9999")
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("B2:b" & lastrow).formula _
= "=vlookup(a2,'sheet 333'!a:e,5,false)"
end with

will fill that range with a vlookup formula.

Sal wrote:

I have information in column A and I wish to write a macro that:

1. Populates cell B2 with a VLOOKUP formula
2. The macro is then to copy the above formula down to the last active cell
in column A

I have tried so many things that I am in a bid of a muddle. Any suggestions
will be very welcome.

Thanks


--

Dave Peterson
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
2 Nesting questions Starchaser Excel Worksheet Functions 7 January 20th 06 06:53 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Macro help - copy a cell down gjcase Excel Discussion (Misc queries) 3 September 4th 05 05:09 AM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM


All times are GMT +1. The time now is 03:31 PM.

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"