Hi There,
I have a VBA macro from work which transfers our reports from one excel sheet to another and then updates itself to particular dates under each user name.
I am totally confused how it works... because it doesn't use any kind of link with the file. I have done VB 6.0 and am out of touch but if I remember correctly you can use an OLEDB connection for it. But in this case I don't see any. The code is below.
Any explanation would be much appreciated
Cheers
Akki
Private Sub butGo_Click()
cwb = ActiveWorkbook.Name
cws = cmbMonth.Value
Worksheets(cws).Activate
Workbooks.Open Filename:=txtFile, ReadOnly:=True
nwb = ActiveWorkbook.Name
Workbooks(cwb).Activate
k = 0
Do While k < 13 And Cells(14 * k + 4, 1) <> ""
stafflook = Workbooks(cwb).Worksheets(cws).Cells(14 * k + 4, 1).Value
i = 4
Do While Workbooks(nwb).Worksheets("Rep Summary").Cells(i, 2).Value <> "" And Workbooks(nwb).Worksheets("Rep Summary").Cells(i, 2).Value <> stafflook
i = i + 1
Loop
repcampaign = Workbooks(nwb).Worksheets("Rep Summary").Cells(i, 5).Value
If repcampaign <> "In" And repcampaign <> "Se" And repcampaign <> "L" And repcampaign <> "T" Then
j = 0
Do While j < 3
Workbooks(cwb).Worksheets(cws).Cells(14 * k + 6 + j, cmbDay.Value + 2).Value = Workbooks(nwb).Worksheets("Rep Summary").Cells(i, 30 + j * 2).Value
Workbooks(cwb).Worksheets(cws).Cells(14 * k + 6 + j, cmbDay.Value + 52).Value = Workbooks(nwb).Worksheets("Rep Summary").Cells(i, 10 + j * 4).Value
j = j + 1
Loop
Workbooks(cwb).Worksheets(cws).Cells(14 * k + 6 + j, cmbDay.Value + 2).Value = Workbooks(nwb).Worksheets("Rep Summary").Cells(I, 45).Value
End If
k = k + 1
Loop
Workbooks(nwb).Close
End Sub