#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default VBA Code

BMistry,
You can find the Last Row of data in columnE with

LastRow = Range("E" & Rows.Count).End(xlUp).row

and use it for autofill

Range("F2").AutoFill _
Destination:=Range("F2:F" & LastRow)

HTH
Cecil



"BMistry" wrote in message
...
Hello,

I have recently started using VB for my excel sheet by
recording a macro and manipulating the code. However, I'm
stuck with a problem which I am hoping someone will be
able to help me with.

In my macro, I insert a column and then a formula on the
first line. Then I double click on the right hand side of
my cell which copies the formula to the bottom of all my
records. However, when i look at the coding it put the
copying as an absolute value ie. F2:F2555. As my data is
being pulled through a ODBC link and is dependant on the
date field (the user can enter a date range for the
report) the number of records it will bring up will be
different every time. Is there anyway, I can change the
code so it copies the formula to all records no matter how
many there are.

I do not want the formula to be copied into cells with
empty records as I will be using the info to create a
pivot table afterwards.

Any help will be much appreciated.

Thanks

B



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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM


All times are GMT +1. The time now is 08:11 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"