Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

runtime error 1004

  Asked By: Madison    Date: Oct 10    Category: MS Office    Views: 745
  

i have created a series of forms in excel which when the user
fills in, creates a quotation.

I have tested it on my computer and it works fine without any errors

I have now emailed it to someone and when they open it and go
through the series of forms they get the following error box come up

Run-time error 1004
Application-defined or object defined error.

The error happens when they return out of the last form. The
quotation is there or there abouts. In the last form, there is
coding which basically shuffles up all the options choosen then
deletes the blank lines, i think this maybe where the error is
coming from possibly, the code i have is as follows

Private Sub cmdVOK_Click()
Me.Hide

If optV1.Value = True Then
Range("A44").Value = "=vlookup(DESCRIPTIONS!A38,DESCRIPTIONS!
A38,1,false)"
Range("B44").Value = "=vlookup(DESCRIPTIONS!B38,DESCRIPTIONS!
B38,1,false)"
Range("C44").Value = 1
Range("D44").Value = "=vlookup(PRICELIST!B39,PRICELIST!B39,1,false)"

ElseIf optV2.Value = True Then
Range("A44").Value = "=vlookup(DESCRIPTIONS!A38,DESCRIPTIONS!
A38,1,false)"
Range("B44").Value = "=vlookup(DESCRIPTIONS!B38,DESCRIPTIONS!
B38,1,false)"
Range("C44").Value = 1
Range("D44").Value = "=vlookup(PRICELIST!B40,PRICELIST!B40,1,false)"
Else
Range("A44").Value = "=vlookup(DESCRIPTIONS!A38,DESCRIPTIONS!
A38,1,false)"
Range("B44").Value = "=vlookup(DESCRIPTIONS!B38,DESCRIPTIONS!
B38,1,false)"
Range("C44").Value = 1
Range("D44").Value = "=vlookup(PRICELIST!B47,PRICELIST!B47,1,false)"

End If

'to delete rows when options not choosen in order to tidy up!
'this has to first sort the data to get all the blank rows together
'this may mean the items are in a strange order?

'added column A to description lookup table which has nos in it to
determine order
'of descriptions (formatted in white so doesnt show) so now
descriptions dont get muddled in diff order
'also added nos in column A to rest of lines of quote so all blanks
get deleted and order doesnt change

Rows("20:20").EntireRow.AutoFit


Range("A21:D46").Select
Selection.Sort Key1:=Range("A21"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("D46").Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value = 0 Then
ActiveCell.EntireRow.Delete Shift:=xlUp
ActiveCell.Offset(-1, 0).Select
Else
ActiveCell.Offset(-1, 0).Select
End If
Loop




'deletes column F - where all the white writing for the circuits was
Columns("F:F").Delete Shift:=xlToLeft
Range("A1").Select

MsgBox "Save file name as per QuoteRef and remember to select
correct file on network to save to", vbExclamation


'following makes prompt come up to save it

Filename = Application.GetSaveAsFilename(, "Excel Files
(*.xls),*.xls")
ActiveWorkbook.SaveAs (Filename)

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on runtime error 1004 Or get search suggestion and latest updates.




Tagged: