I have created a Sheet1(BILL FORMAT) in excel to save my records in a sheets like sheet3(ITEM DATA). But after few days working with this Sheet1(BILL FORMAT), it is now goes slower, because of heavy data saving in sheet3(ITEM DATA). Now I want to save all records to a Access database and want to keep clean my sheet3(ITEM DATA). So I can work on my Sheet1(BILL FORMAT) easily or without any delay. Also wants updates my record by calling it via serial numbers. but I don't want to keep any record in my sheet3(ITEM DATA).
Given below link is good for save invoice records. Because its saves records one by one row. PREVIOUS RELATED LINK
But now i also required save invoice Items Records.
My Little Code is mentioned below: -
Sub SAVE_DATA()
i = 1
Do Until Sheets("ITEM DATA").Range("C" & i).Value = ""
If Sheets("ITEM DATA").Range("C" & i).Value = Sheets("BILL FORMAT").Range("B1").Value Then
'Ask overwrite invoice #?
'If MsgBox("Overwrite invoice data?", vbYesNo) = vbNo Then
Exit Sub
Else
Exit Do
'End If
End If
i = i + 1
Loop
i = 1
Set rng_dest = Sheets("ITEM DATA").Range("G:K")
'Delete rows if invoice # is found
Do Until Sheets("ITEM DATA").Range("C" & i).Value = ""
If Sheets("ITEM DATA").Range("C" & i).Value = Sheets("BILL FORMAT").Range("B1").Value Then
Sheets("ITEM DATA").Range("C" & i).EntireRow.Delete
i = 1
End If
i = i + 1
Loop
Set rng_dest = Sheets("ITEM DATA").Range("G:K")
' Find first empty row in columns G:K on sheet ITEM DATA
Do Until WorksheetFunction.CountA(rng_dest.Rows(i)) = 0
i = i + 1
Loop
'Copy range A7:E11 on sheet BILL FORMAT to Variant array
Set Rng = Sheets("BILL FORMAT").Range("A7:E11")
' Copy rows containing values to sheet ITEM DATA
For a = 1 To Rng.Rows.Count
If WorksheetFunction.CountA(Rng.Rows(a)) <> 0 Then
rng_dest.Rows(i).Value = Rng.Rows(a).Value
'Copy SR. NO.
Sheets("ITEM DATA").Range("C" & i).Value = Sheets("BILL FORMAT").Range("B1").Value
'Copy NAME
Sheets("ITEM DATA").Range("D" & i).Value = Sheets("BILL FORMAT").Range("B2").Value
'Copy LOCATION
Sheets("ITEM DATA").Range("E" & i).Value = Sheets("BILL FORMAT").Range("B3").Value
'Copy CONTACT
Sheets("ITEM DATA").Range("F" & i).Value = Sheets("BILL FORMAT").Range("B4").Value
i = i + 1
End If
Next a
Application.ScreenUpdating = False
On Error Resume Next
Sheet3.Columns("G:G").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.ScreenUpdating = True
Range("B1").Value = Range("B1").Value + 1
Range("B2:B4").ClearContents
Range("A7:D11").ClearContents
Range("B2").Select
End Sub
and i have no idea how to convert this sheet code to link with access database.
any help will be appreciated.