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: 79
Default Help, Macro wont run from a particular worksheet

The following code works when I run it from any worksheet in my workbook
except one titled "Instructions". It fails on the following line of code:

Range("H3").Autofill Destination:=Range("H3:H" & cLastRow)


Does anyone have any idea why it would fail or any solutions? As previously
stated it runs from any other worksheet.

Joel

Sub Cleanup()
cLastRow = Cells(Rows.Count, "C").End(xlUp).Row - 1
'This Begins the Cleanup Process, Adds Titles, & Total Budgets
'for calculated Cummulative Percent Completes
Worksheets("Export").Activate
Range("1:1").Delete
Range("1:1").Clear
Range("B:B,D:E,J:K").Delete
With Rows("2:2")
.WrapText = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Range("A2").Value = ("Discipline")
Range("B2").Value = ("Week Beginning")
Range("C2").Value = ("Early Ave.")
Range("D2").Value = ("Early Cumm.")
Range("E2").Value = ("Late Ave.")
Range("F2").Value = ("Late Cumm.")
Range("D1").Formula = "=MAXA(d3:d20000)"
Range("F1").Formula = "=MAXA(f3:f20000)"
Range("H2").Value = "Week Ending"
Range("I2").Value = "Discipline"
Range("J2") = "Planned Ave." & Chr(10) & "Manpower"
Range("K2").Value = "Target Early" & Chr(10) & "% Comp."
Range("L2").Value = "Target Late" & Chr(10) & "% Comp."
'This Adds Week Ending Column
Range("H3").Formula = "=B3+6"
Range("H3").Autofill Destination:=Range("H3:H" & cLastRow)
'This Adds the Discipline Column for the Data Sheet
Range("I3") = "=A3"
Range("I3").Autofill Destination:=Range("I3:I" & cLastRow)
'This Adds the Planned Column & Propts the User for the days per
'week worked to perform the conversion from mandays to men.
Range("J1").Value = InputBox("Enter the No. Days/Week Worked" & vbCr _
& "Use No. of Days in Default P3 Calendar" & vbCr _
& "Doesn't have to be an Integer")
'This Calculates Average Manpower
Range("J3").Formula = "=AVERAGE(C3,E3)/$J$1"
Range("J3").Autofill Destination:=Range("J3:J" & cLastRow)
Range("J3:J19").NumberFormat = "#,##0.0_);(#,##0.0)"
'This Adds the Column for Early % based on Cummulative Early Values
Range("D1").Formula = "=MAXA(d3:d20000)"
Range("K3").Formula = "=d3/d$1"
Range("K3").Autofill Destination:=Range("K3:K" & cLastRow)
'This Adds the Column for Late % and calculates based on Cummulative Late
Values
Range("F1").Formula = "=MAXA(f3:f2000)"
Range("L3").Formula = "=F3/F$1"
Range("L3").Autofill Destination:=Range("L3:L" & cLastRow)
Range("K:L").NumberFormat = "0.0%"
Range("K:L").ColumnWidth = 8
Range("H:H,I:I").ColumnWidth = 11.5
Columns("J:J").ColumnWidth = 9
Worksheets("Charts").Activate
End Sub


 
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
Macro security prompt wont go away mark Stephens Setting up and Configuration of Excel 2 May 26th 09 03:45 PM
Keep getting error, wont run macro! HELP! Myles Excel Discussion (Misc queries) 2 March 30th 09 03:58 PM
Date format from excel to CVS file wont. Change in CVS wont stay. Fish''s Mermaid Excel Worksheet Functions 1 October 14th 06 12:28 AM
Macro wont run! Joe Excel Discussion (Misc queries) 9 January 17th 06 07:01 PM
Macro that wont go away - Help taxmom Excel Worksheet Functions 3 April 13th 05 06:39 PM


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