Auto Fill Macro Not Working Properly

Hi,

I used a macro that I found through this newsgroup that 
auto fills down when you've got spaces in Column A that 
need filling with a prior value.  It looks like this.

Sub FillBlanksColumnA()
Application.ScreenUpdating = False
Extent = Cells.Rows.Count
For i = 2 To Extent
  If Cells(i, 1) = "" Then Cells(i, 1) = Cells(i - 1, 1)
  Next i
End Sub

My problem is that this continues onto line 65000+.  How 
can I revise this macro to stop when there is a blank or 
no value in Col B?  Or can it be revised to say stop at 
line 2000?

Thanks in advance.

Jason

0
9/11/2003 10:15:54 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
449 Views

Similar Articles

[PageSpeed] 53

Jason,

If you want to limit it to 2000 rows, just change the line For i = 2 to
Extent to read For i = 2 to 2000

Alternatively if you want it to keep going until it finds a blank row in
column B try this variation:

Sub FillBlanksColumnA()
Application.ScreenUpdating = False
i = 2
    Do Until Cells(i, 2).Value = ""
    If Cells(i, 1) = "" Then Cells(i, 1) = Cells(i - 1, 1)
    i = i + 1
    Loop
End Sub

HTH

Mitch

"Jason" <jasonkaplan@wideopenwest.com> wrote in message
news:06bf01c378b2$44a59540$a101280a@phx.gbl...
> Hi,
>
> I used a macro that I found through this newsgroup that
> auto fills down when you've got spaces in Column A that
> need filling with a prior value.  It looks like this.
>
> Sub FillBlanksColumnA()
> Application.ScreenUpdating = False
> Extent = Cells.Rows.Count
> For i = 2 To Extent
>   If Cells(i, 1) = "" Then Cells(i, 1) = Cells(i - 1, 1)
>   Next i
> End Sub
>
> My problem is that this continues onto line 65000+.  How
> can I revise this macro to stop when there is a blank or
> no value in Col B?  Or can it be revised to say stop at
> line 2000?
>
> Thanks in advance.
>
> Jason
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003


0
mitchpom (9)
9/11/2003 10:35:24 PM
I like this macro, there would be times where this would be handy. Where do
I add this macro?
thanks for you help

Kevin

"MJP" <mitchpom@terfmop.freeserve.co.uk> wrote in message
news:bjqt99$pcs$1@news6.svr.pol.co.uk...
> Jason,
>
> If you want to limit it to 2000 rows, just change the line For i = 2 to
> Extent to read For i = 2 to 2000
>
> Alternatively if you want it to keep going until it finds a blank row in
> column B try this variation:
>
> Sub FillBlanksColumnA()
> Application.ScreenUpdating = False
> i = 2
>     Do Until Cells(i, 2).Value = ""
>     If Cells(i, 1) = "" Then Cells(i, 1) = Cells(i - 1, 1)
>     i = i + 1
>     Loop
> End Sub
>
> HTH
>
> Mitch
>
> "Jason" <jasonkaplan@wideopenwest.com> wrote in message
> news:06bf01c378b2$44a59540$a101280a@phx.gbl...
> > Hi,
> >
> > I used a macro that I found through this newsgroup that
> > auto fills down when you've got spaces in Column A that
> > need filling with a prior value.  It looks like this.
> >
> > Sub FillBlanksColumnA()
> > Application.ScreenUpdating = False
> > Extent = Cells.Rows.Count
> > For i = 2 To Extent
> >   If Cells(i, 1) = "" Then Cells(i, 1) = Cells(i - 1, 1)
> >   Next i
> > End Sub
> >
> > My problem is that this continues onto line 65000+.  How
> > can I revise this macro to stop when there is a blank or
> > no value in Col B?  Or can it be revised to say stop at
> > line 2000?
> >
> > Thanks in advance.
> >
> > Jason
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003
>
>


0
9/12/2003 2:33:08 AM
Reply:

Similar Artilces:

Auto Filter problem
I am using the auto filter for a particular column to sort out differen medical programs. When I click the drop down and click a program, i doesnt show me ALL the lines that say this particular program. Why is this? -- Message posted from http://www.ExcelForum.com Hi maybe some hidden characters in these lines 8e.g. additional space characters, etc.) -- Regards Frank Kabel Frankfurt, Germany "jkb724 >" <<jkb724.19rasx@excelforum-nospam.com> schrieb im Newsbeitrag news:jkb724.19rasx@excelforum-nospam.com... > I am using the auto filter for a particular column to so...

Trace Dependents doesn't work (precedents does!)
I have 5 separate workbooks where the trace precedents works, but trace dependents doesn't. All the happens is I get a dialogue box saying that 'The Trace Dependents command found no formulas that refer to the active cell' when clearly there are. Obviously, there is something in common with all of them which is preventing it from working. What concerns me is that the sheets are somehow corrupt and are not calculating properly - which is going to be a problem as the sheets are financial and need to be signed off by an external auditor! I have found threads suggesting other users h...

combining macros
If you write several macros and then write a macro that runs all the macros you have written it will then have your excel file name as part of it. If you save this file under a different name the macro that runs all macros does not change the file name, thats part of the macro, to the new name. Is there a setting that will enable this to change or something else that can be done to have it automatically change with the file name change? Thanks Hi, There is no setting you mention. But I'm not sure why this is a problem. All the macros are stored in your excel file - you'll see the f...

Apple Mail not working right???
Ok, so I installed Office:Mac 2004, now all of a sudden, my Apple Mail (the Apple provided email application) dock icon no longer shows me how many messages I have waiting! VERY irritating!! This sequence of events started last night when I first installed Office, and then lo and behold when I opened Word for the first time, all of these fonts got installed. I'm an Extensis Suitcase kind of guy. I don't really like all those fonts in my system folder. I've even disabled all the other "stock" fonts except for Geneva and Lucida Grande. I also had Arial enabled since that&#...

Auto-Editing
Word 2003 has a very annoying default. It assumes too much! If I reformat a few words in a document, it changes the entire document to that formatting. Grr-rrr-r! I have to constantly press undo to get what I want. I know there's a feature that's causing this annoyance but I can't find it to turn it off! Can anyone help, please? See http://word.mvps.org/faqs/formatting/wholedocumentreformatted.htm. -- Stefan Blom Microsoft Word MVP "Connie Martin" <ConnieMartin@discussions.microsoft.com> wrote in message news:CD959D82-F81B-4A9D-993E-73...

what exactly is a macro?
-- greenpea A set of instructions to automate things you do by hand. See: http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Gary''s Student - gsnu200716 "Maddie" wrote: > > -- > greenpea ...

Function does not work
I the below function behind a field in a form in Access 2003 - but I can't seem to get it to work. The function fires on the Save Event, but then errors on the OpenDatabase(....) - I have checked the name of the database and that is fine. Any thoughts? Thanks for your time. Private Function DischargeDateUpdated() 'Create variables Dim dbMyDB As Database Dim rsMyRS As recordSet Set dbMyDB = OpenDatabase("MST_Referral_Tracking.mdb") 'Debug only MsgBox "dbopen", vbOKOnly Set rsMyRS = dbMyDB.OpenRecordset("FollowUp", d...

Auto-Calculate
I have a spreadsheet that utilize the stock quote add-in from MSN. On a daily basis I refresh the add-in functions for the Highs, Lows, Last, Volume, etc. On occasion the spreadsheet reverts to manual caculation settings, and I have to press the F9 even after I updated the quotes. I've always preferred the any spreadsheets I open, blank or otherwise, the automatic setting selected for calculations. I consider this an annoyance. Has anyone experienced this glitch? Is there a fix for it? Ron_D Ron Excel takes the calculation mode from the first workbook that opens in a session. Sub...

<Refresh All> not working properly
Hello I have a number of web queries in a single Excel worksheet. If I select <Refresh All> then some update but some don't. If I refresh them individually then thye work fine. Any reason for this and how may I get around this? Regards Alex ...

auto copy self
How do I arrange for Outlook to automatically copy myself on every new, reply or forward email? If you mean keep a copy of all sent, see settings under Tools/Options/Email Options and Advanced Options David "rich" <steamuk@aol.com> wrote in message news:055c01c3664f$dadecd30$a001280a@phx.gbl... > How do I arrange for Outlook to automatically copy myself > on every new, reply or forward email? ...

Macro help
I had a macro in my workbook and deleted it b/c I did not want it anymore. Now whenever I open the workbook it prompts me to enable or disable the macro even though I have deleted it from the Tools menu. Any help on how to get rid of this? Hi Meredith Look here http://www.contextures.com/xlfaqMac.html#NoMacros -- Regards Ron de Bruin http://www.rondebruin.nl "Meredith" <anonymous@discussions.microsoft.com> wrote in message news:205f701c45923$e1d470a0$a401280a@phx.gbl... > I had a macro in my workbook and deleted it b/c I did not > want it anymore. Now wheneve...

Macro help needed #3
I'm learning macros at the moment and thought I'd venture to write one which I needed myself but I could do with some help, since I spent hours today trying everything that occured to me and searching the internet when I should be studying since I've an exam on macros tomorrow. I import an list of people from the internet by using a web query in excel (labelled provisions) I selected a group using the first letter of the last name and used record macro to copy the selection and paste the values into another worksheet labelled with that letter, eg labelled A. At the end of the m...

How to set macro to run every 15 minutes?
Does anyone have any suggestions on how to set macro to run every 15 minutes? Thanks in advance for any suggestions Eric See: http://www.ozgrid.com/Excel/run-macro-on-time.htm -- Regards Dave Hawley www.ozgrid.com "Eric" <Eric@discussions.microsoft.com> wrote in message news:A6A6F8B2-6FB6-4E02-87F9-4F8D08626223@microsoft.com... > Does anyone have any suggestions on how to set macro to run every 15 > minutes? > Thanks in advance for any suggestions > Eric Stolen from a very nearby universe, er, answer to a question, and modified to prot...

Auto correct or Auto complete
We are all familiar witht he auto correct or auto complete functions found in MS applications. Of course that means it is available in Access also. My question is this ... can this function be replicated within the DB, so that the set of auto correct items are part of the package rather than something that would have to be set up on each individual desktop system? It's use, for me, would primarily be within a memo field where medical abreviations, used as a shortcut, would convert to the true meaning as the user types them in. Ex: "prn" without quotes would change to. &qu...

Auto Scale Chart Macro -- Any improvements please?
This is the best way I've found to correctly scale a chart -- the only way I found to exclude a chart interpolating with #NA cells was to delete those cells containing #NA, and run the chart. This takes a long time on my computer. Wondering if there is a better way. This macro is directly taken from 2 excel mvps and modified; i believe a mehta and ron bovarty, but could be wrong. Thanks for taking a look. Sub AutoScaleYAxes() Dim ValuesArray(), SeriesValues As Variant Dim Ctr As Integer, TotCtr As Integer Application.Run "Extend_Stock_Data" Applic...

OWA auto login
I am trying to use the credentials from the forms authentication login to automaticaly log in to Outlook Web. I redirect to a URL with this format: http://UserName:Password@mailserver/exchange I have seen this example in other posts but this does not work for me. I still get the Outlook Windows Login prompt. Perry Perecli Manole wrote: > I am trying to use the credentials from the forms authentication > login to automaticaly log in to Outlook Web. I redirect to a URL with > this format: http://UserName:Password@mailserver/exchange > I have seen this example in other posts but t...

Auto look through subfolders
Please help. I can write a macro that will extract data from all excel files in a specific folder. What I need to be able to do is write a macro that will automatically extract data from excel files within folders and sub folders and sub sub folders etc For example the data is all held on the following directory: H:\development forms\2006 cost sheets\ And within that directory by customer - for example Tesco, Boots, Asda etc. These customers are then subdivided into product ranges - eg 1,2,3,4 etc and some futher subdivided by national or exclusive. All the excel files are in exactly th...

question about data from excel to work
I am trying to take input from an excel sheet and mailmerge it to word....the thing is I want to make it so from here on out ..if I change something in the excel sheet it automatically updates on word as well..if not a mail merger what can I use ? -- Pooja Kamdar Hi Pooja Kamdar, You can link the Word document to the Excel workbook, so that any changes in the Excel workbook will be reflected in the Word document. To do this: 1. copy the source range in the Excel workbook 2. in the Word document, use Edit|Paste Special > Paste Link and choose the paste format you wan...

Any way to get rid of an auto-suggestion in the login dialog box, for Exchange/OL using RPC over HTTP?
A client was using RPC over HTTP to two different Exchange servers (OL prompting for profile on startup). Both profiles were set up to prompt for credentials upon connection to Exchange. There's now only one Outlook profile needed; the other is gone and OL isn't prompting for the profile selection any longer, which is fine. However, Outlook is remembering domain1\user and domain2\user in the login dialog box, and I'd love to be able to get rid of the no-longer-valid credential dropdown suggestion. (The computer is not a member of a domain and hence always needs to be prom...

SAVE FILE
I have developed a file with a macro which is protected by a password. A "Save" button with the assigned macro calls the procedure in the macro and when I am trying to save a file the following message appears "You cannot save this file format when the VBA Project is protected You may unprotect the VBA Project by......" What do you suggest I do to save a file with a protected macro? The macro must be protected, it is very important for me not to allow access to the macro in totallity. I am using certain cells' information to name the file My code lo...

macro help = extract content of specific columns accross a row
have a spreadsheet which consists of about 5125 rows and 2840 columns. I am using Excel 2007 in order to get access to the extra columns. Now I need help creating a macro to automate a very tedius and manual task. The first column in the spreadsheet is empty. What I Need =========== For every row I would like to extract the contents of certain columns accross the row and copy to the first column of the row. into the first column i would like to copy the contents of the following columns accross the row. 6C = sixth column, 9C = 9th column etc... 6C + " " + 7C + " &...

remove macro #2
Hi every time I start an excel workbook I have made I get the security warning about running macros but as far as I can tell there are no macros in the workbook. When I go to tools/macro there are no macros visible in the box that appears. So what is causing the security message to appear? And how can I stop it? If I set the security level to low the message does not appear. Windows XP Pro SP2 and Office 2003 Thanks Ron Press ALT+F11 to open the VBA editor. Delete any text in any of the modules under "Microsoft Excel Object" and delete any modules under "Modules"...

Auto date
I am trying to create a field in a form that if anything is changed on it, it will automatically update the date to current date. Is this possible? Sojaminc wrote: >I am trying to create a field in a form that if anything is changed on it, it >will automatically update the date to current date. Is this possible? Make sure the last changed date/time field is in the form's record source table/query. Then use the form's BeforeUpdate event: Me.lastchanged = Now -- Marsh MVP [MS Access] Hi - You can do this in the On Dirty event of the form, which fires as soon as you m...

An auto reply to an auto reply!
Had the funniest situation yesterday. Somebody emailed a public folder we have set up. On there we have a rule to send a reply saying thanks for your email -someone will be with you shortly (we have to have this message on - it is for some website that recently went live). Now that auto reply went back to the guy who emailed - who must have sent it from a public folder himself (as he forwarded the original email from a public folder). The guy received our auto reply - and promptly his email system sent an auto reply to us. As is the way it is set up - our email system sent him an auto ...

Macro to turn on "Track Changes" function
I'm trying to create a macro that turns on the "Track Changes" function with a shortcut key. The problem is that while I'm recording the macro the traditional way, the recording process stops when the "Track Changes" function is turned on. Is there a way to overcome this problem or is the "Track Changes" function not possible to put into a macro, even in Visual Basic? ...