Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear users,
I have the following macro, which is working fine (surely, there can be improvement): Private Sub CommandButtonUpdate_Click() Dim i As Integer Dim j As Integer Dim idString As String Dim sFilePath As String Dim NameStaff As String Dim wbNew As Workbook Dim wb As Workbook Set wb = ActiveWorkbook Application.ScreenUpdating = False For i = 1 To 32 j = i + 7 idString = ActiveSheet.Range("C" & j).Text If idString < "" Then sFilePath = "L:\Year Planner\PresenceCheck\users\" & idString Application.DisplayAlerts = False Workbooks.Open sFilePath Set wbNew = ActiveWorkbook wb.Sheets(1).Range("D" & j).Value = wbNew.Sheets(1).Range("D9").Value wb.Sheets(1).Range("E" & j).Value = wbNew.Sheets(1).Range("D20").Value wbNew.Close End If Next Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub My problem: the purpose of this macro is to go into each staffs own Excel file (all saved on server) to get the info wb.Sheets(1).Range("D" & j).Value = wbNew.Sheets(1).Range("D9").Value wb.Sheets(1).Range("E" & j).Value = wbNew.Sheets(1).Range("D20").Value However, our staff has opened these files all the time. As soon as a file is already opened, the update does not work anymore. How can I avoid this problem (I guess it is read-only). PLEASE HELP! Thanks a lot. Regards, Rico |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
delete info from source file w/out changing the destination file | New Users to Excel | |||
In Excel - Use Windows Explorer instead of File Open to open file | Excel Discussion (Misc queries) | |||
open workbooks to extract info into one | Excel Programming | |||
Open a file do a macro ( made) and open next succesive file | Excel Programming | |||
Open a text file and get the info | Excel Programming |