Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I've got an 1004 error showing up with the following line. N = Wrks1.Cells(i, 1).Value I've tried declaring the N variable as a string and as a variant, but no good. I know its probably something simple but I can't see it. Some help please. Here is the entire code Option Explicit Sub ImportEstToProd() Dim Wrks1 As Worksheet, Wrks2 As Worksheet, Wrks3 As Worksheet, Wrks5 As Worksheet Dim CopyRow As Long Dim Msg As Integer Dim Response As Integer Dim Entries As Long Dim i As Long Dim N As String Msg = MsgBox("Estimates are complete and are ready" _ & " to be imported into the Production Tracking Sheet?" _ & (Chr(13)) & "Answering Yes will clear all previous daily tracking input!" _ & (Chr(13)) & "This action is not undoable!", _ vbYesNo + vbQuestion, "Import Estimate Information") If Msg = 6 Then 'Application.ScreenUpdating = False 'Application.EnableEvents = False 'On Error GoTo RET Set Wrks1 = Worksheets("Drywall set up sheet") Set Wrks2 = Worksheets("Stucco set up sheet") Set Wrks3 = Worksheets("Plaster set up sheet") Set Wrks5 = Worksheets("Production") Entries = Excel.WorksheetFunction.CountA(Wrks1.Range("LaborD BDW")) Wrks5.Range("DailyProdInput").ClearContents CopyRow = Wrks5.Range("ProductionTopRow").Row + 1 For i = 0 To Entries + 25 N = Wrks1.Cells(i, 1).Value If N = "X" Then With Wrks5 ..Cells(CopyRow, 1).Value = Wrks1.Cells(i, 3).Value ..Cells(CopyRow, 2).Value = Wrks1.Cells(i, 2).Value ..Cells(CopyRow, 3).Value = Wrks1.Cells(i, 5).Value ..Cells(CopyRow + 1, 3).Value = Wrks1.Cells(i, 7).Value End With CopyRow = CopyRow + 3 End If Next i 'RET: 'Application.EnableEvents = True 'Application.ScreenUpdating = True End If If Msg = 7 Then Exit Sub End If End Sub -- Casey ------------------------------------------------------------------------ Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545 View this thread: http://www.excelforum.com/showthread...hreadid=537003 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming | |||
Run time error 1004 General ODCB Error | Excel Programming | |||
Application Run Time Error 1004 and Stack Error | Excel Programming | |||
Simple For-Loop gives 1004 error using variable to EntireRow.Delete | Excel Programming |