i have 5 textboxes driver 1,2,3,4,5 im trying to save the information to cells in my excel spreadsheet but when i run it and open excel nothing is saved? This is what i have so far
Sub saveWSR(ByVal b, r)
Dim XLapp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set XLapp = CreateObject("Excel.Application")
Set xlBook = XLapp.Workbooks.Open("C:\Driver\Driver.xls")
Set xlSheet = xlBook.Worksheets("DRiver")
r = r
b = b
For a = 1 To 5
xlSheet.Cells(r, b).Value = Me("drName" & a).Value
xlSheet.Cells(r + 1, b) = Me("totalSales" & a).Value
xlSheet.Cells(r + 2, b) = Me("netSales" & a).Value
xlSheet.Cells(r + 5, b) = Me("creditCards" & a).Value
xlSheet.Cells(r + 7, b).Formula = "20"
b = b + 1
Next a
XLapp.DisplayAlerts = False
XLapp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set XLapp = Nothing
end sub
Sub saveWSR(ByVal b, r)
Dim XLapp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set XLapp = CreateObject("Excel.Application")
Set xlBook = XLapp.Workbooks.Open("C:\Driver\Driver.xls")
Set xlSheet = xlBook.Worksheets("DRiver")
r = r
b = b
For a = 1 To 5
xlSheet.Cells(r, b).Value = Me("drName" & a).Value
xlSheet.Cells(r + 1, b) = Me("totalSales" & a).Value
xlSheet.Cells(r + 2, b) = Me("netSales" & a).Value
xlSheet.Cells(r + 5, b) = Me("creditCards" & a).Value
xlSheet.Cells(r + 7, b).Formula = "20"
b = b + 1
Next a
XLapp.DisplayAlerts = False
XLapp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set XLapp = Nothing
end sub