Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Autofill problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barkomatic - 12 Apr 2008 16:09 GMT
I've got a macro that will take the value in the previous cell and
extend the series to the adjacent cells.  Unfortunately, it isn't
acting in quite the way I had planned.  The number of cells to be
filled is variable.  For instance, a year will be entered into cell
L125 and should be extended thru to T125.  The next row might have a
year entered in P126 and should be extended thru T126.  So the end
point is always the same.  Only the starting point varies.  Here is
the code I have for the macro so far:

   ActiveCell.Offset(0, -1).Range("A1").Select
   Selection.AutoFill Destination:=ActiveCell.Range("A1:I1"),
Type:=_xlFillSeries
   ActiveCell.Range("A1:I1").Select

So how do I tell it to always end in Row T no matter where it starts?
JLGWhiz - 12 Apr 2008 16:32 GMT
If you preset your fill range so that it specifies column T as the end of the
range it should work.

Sub atofl()
   ActiveCell.Offset(0, -1).Range("A1").Select
   Set FillRange = Range(Cells(ActiveCell.Row, ActiveCell.Column), _
    Cells(ActiveCell.Row, "T"))
   Selection.AutoFill Destination:=FillRange, Type:=xlFillSeries
   ActiveCell.Range("A1:I1").Select
End Sub

> I've got a macro that will take the value in the previous cell and
> extend the series to the adjacent cells.  Unfortunately, it isn't
[quoted text clipped - 11 lines]
>
> So how do I tell it to always end in Row T no matter where it starts?
Barkomatic - 12 Apr 2008 17:09 GMT
>    ActiveCell.Offset(0, -1).Range("A1").Select
>    Set FillRange = Range(Cells(ActiveCell.Row, ActiveCell.Column), _
>     Cells(ActiveCell.Row, "T"))
>    Selection.AutoFill Destination:=FillRange, Type:=xlFillSeries
>    ActiveCell.Range("A1:I1").Select

Thanks!  That worked like a charm.  I appreciate the quick response,
too.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.