LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default For Each ws autofill

Hi,

I have tried various combinations to try and get this to work to no avail.
It is only to fun on those worksheets between the 'First' worksheet and
'Last" worksheet. What is wrong with my code? I'm getting a 'Select method
of range class failed'.

Sub AutofillFormula()

Dim ws As Worksheet
Dim FirstIndex As Long
Dim LastIndex As Long

FirstIndex = Firstpg.Index
LastIndex = Lastpg.Index

For Each ws In ThisWorkbook.Worksheets

If ws.Index FirstIndex Then
If ws.Index < LastIndex Then

ws.Range("N49").Select
Selection.AutoFill Destination:=Range("N49:N349"),
Type:=xlFillDefault
ws.Range("N49:N349").Select

End If
End If
Next ws

End Sub
--
Thanks for your help.
Karen53
 
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
Autofill Dominique Feteau[_2_] Excel Programming 1 September 21st 05 07:48 AM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Autofill carg1[_5_] Excel Programming 2 October 28th 04 02:47 PM
Help With Autofill Jason Excel Programming 6 October 5th 04 04:05 AM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM


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