Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Another simple error...
I created the following code, and get 1004 errors. Could you please explain why?
Sheets("Power Units").Activate With ActiveSheet .Range("A3:AV3").Select .Selection.AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), Type:=xlFillDefault Range(Cells(4, 1), Cells((response - 2) * 0.4, 48)).Select Selection.Copy End With I've tried it with the "."'s all over, wihtout success. I guess I don't know why these errors occur - It seems a bit arbitrary when they occur. Thanks in advance... Jim Berglund |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Another simple error...
How about this
With Sheets("Power Units") .Range("A3:AV3").AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), _ Type:=xlFillDefault .Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)).Copy End With -- HTH RP (remove nothere from the email address if mailing direct) "Jim Berglund" wrote in message news:iQ4Qd.388530$6l.283192@pd7tw2no... I created the following code, and get 1004 errors. Could you please explain why? Sheets("Power Units").Activate With ActiveSheet .Range("A3:AV3").Select .Selection.AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), Type:=xlFillDefault Range(Cells(4, 1), Cells((response - 2) * 0.4, 48)).Select Selection.Copy End With I've tried it with the "."'s all over, wihtout success. I guess I don't know why these errors occur - It seems a bit arbitrary when they occur. Thanks in advance... Jim Berglund |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Another simple error...
What is your code supposed to do? I assume response is a variable? Where does
it come from and what type is it? It definitely will not run in its current form, but until I know what it is intended to do I really can't help... "Jim Berglund" wrote: I created the following code, and get 1004 errors. Could you please explain why? Sheets("Power Units").Activate With ActiveSheet .Range("A3:AV3").Select .Selection.AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), Type:=xlFillDefault Range(Cells(4, 1), Cells((response - 2) * 0.4, 48)).Select Selection.Copy End With I've tried it with the "."'s all over, wihtout success. I guess I don't know why these errors occur - It seems a bit arbitrary when they occur. Thanks in advance... Jim Berglund |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Another simple error...
Thanks, Bob. I plugged it in, but still no joy!
I get a 1004 error on the Purple line ( .Range("A3:AV3").AutoFill Destination:=.Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)), Type:=xlFillDefault) Here's the complete code. Private Sub CommandButton1_Click() Dim response Dim newWO, i, j As Integer response = InputBox("Enter the number of WO's you want to create") ScreenUpdating = False With Sheets("Power Units") .Range("A3:AV3").AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), _ Type:=xlFillDefault .Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)).Copy End With ... End Sub "Bob Phillips" wrote in message ... How about this With Sheets("Power Units") .Range("A3:AV3").AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), _ Type:=xlFillDefault .Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)).Copy End With -- HTH RP (remove nothere from the email address if mailing direct) "Jim Berglund" wrote in message news:iQ4Qd.388530$6l.283192@pd7tw2no... I created the following code, and get 1004 errors. Could you please explain why? Sheets("Power Units").Activate With ActiveSheet .Range("A3:AV3").Select .Selection.AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), Type:=xlFillDefault Range(Cells(4, 1), Cells((response - 2) * 0.4, 48)).Select Selection.Copy End With I've tried it with the "."'s all over, wihtout success. I guess I don't know why these errors occur - It seems a bit arbitrary when they occur. Thanks in advance... Jim Berglund |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Another simple error...
Jim,
There seem to be 2 problems with the code. One is that when using autofil, the destination range must include the copy range. The second is that a cell address cannot be a part number, so the *0.4 looks suspect. This works, but I am not sure the correct number of rows for your needs Private Sub CommandButton1_Click() Dim response Dim newWO, i, j As Integer Dim rng As Range response = InputBox("Enter the number of WO's you want to create") Application.ScreenUpdating = False With Sheets("Power Units") Set rng = .Range("A3:AV3").Resize(response, 48) .Range("A3:AV3").AutoFill Destination:=rng, Type:=xlFillDefault rng.Copy End With '... End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Jim Berglund" wrote in message news:yd6Qd.388754$8l.352400@pd7tw1no... Thanks, Bob. I plugged it in, but still no joy! I get a 1004 error on the Purple line ( .Range("A3:AV3").AutoFill Destination:=.Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)), Type:=xlFillDefault) Here's the complete code. Private Sub CommandButton1_Click() Dim response Dim newWO, i, j As Integer response = InputBox("Enter the number of WO's you want to create") ScreenUpdating = False With Sheets("Power Units") .Range("A3:AV3").AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), _ Type:=xlFillDefault .Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)).Copy End With ... End Sub "Bob Phillips" wrote in message ... How about this With Sheets("Power Units") .Range("A3:AV3").AutoFill Destination:=.Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)), _ Type:=xlFillDefault .Range(.Cells(4, 1), .Cells((response - 2) * 0.4, 48)).Copy End With -- HTH RP (remove nothere from the email address if mailing direct) "Jim Berglund" wrote in message news:iQ4Qd.388530$6l.283192@pd7tw2no... I created the following code, and get 1004 errors. Could you please explain why? Sheets("Power Units").Activate With ActiveSheet .Range("A3:AV3").Select .Selection.AutoFill Destination:=.Range(.Cells(4, 1), ..Cells((response - 2) * 0.4, 48)), Type:=xlFillDefault Range(Cells(4, 1), Cells((response - 2) * 0.4, 48)).Select Selection.Copy End With I've tried it with the "."'s all over, wihtout success. I guess I don't know why these errors occur - It seems a bit arbitrary when they occur. Thanks in advance... Jim Berglund |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
#VALUE Error should be simple fix | Excel Discussion (Misc queries) | |||
Fix Simple #Div/0! error | Excel Worksheet Functions | |||
Simple #DIV/0! error | Excel Worksheet Functions | |||
Cannot trace this simple error | Excel Programming | |||
Simple INT error? | Excel Programming |