-
Thanks Cat Daddy,
Still I cant get updates in all worksheet in a workbook, it updates only in current sheet.
I have changed VBA as such:
[vba]Sub Updates()
Dim wb As Workbook
For Each wb In Application.Workbooks
'do updating here
Next
Dim n As Long, k As Long
Application.ScreenUpdating = False
Range(ActiveCell, ActiveCell.Offset(Val(1) - 1, 0)).EntireRow.Insert
k = ActiveCell.Offset(-1, 0).Row
n = Cells(k, 83).End(xlToLeft).Column
Range(Cells(k, 83), Cells(k + Val(1), n)).FillDown
With ActiveCell
.Value = Format(Date, "dd-mmm-yy")
.Offset(0, 1).Value = "MH"
End With
Dim SheetName As String
Dim ActiveDate As String
PathO = "C:\Bhav Copy\"
SheetName = ActiveSheet.Name
ActiveDate = Cells(ActiveCell.Row, 1)
DD = Mid(ActiveDate, 1, 2)
MM = Mid(ActiveDate, 4, 3)
YY = Mid(ActiveDate, 8, 2)
If MM = "Jan" Then MMO = "01"
If MM = "Feb" Then MMO = "02"
If MM = "Mar" Then MMO = "03"
If MM = "Apr" Then MMO = "04"
If MM = "May" Then MMO = "05"
If MM = "Jun" Then MMO = "06"
If MM = "Jul" Then MMO = "07"
If MM = "Aug" Then MMO = "08"
If MM = "Sep" Then MMO = "09"
If MM = "Oct" Then MMO = "10"
If MM = "Nov" Then MMO = "11"
If MM = "Dec" Then MMO = "12"
FileNameO = PathO + "EQ" + DD + MMO + YY + ".CSV"
If Dir(FileNameO) = "" Then
MsgBox "File Doesn't Exist (" + FileNameO + ")"
Exit Sub
End If
SheetName = UCase(SheetName)
Open FileNameO For Input As #1
While Not EOF(1)
Input #1, A1$, A2$, A3$, A4$, A5$, A6$, A7$, A8$, A9$, A10$, A11$, A12$, A13$, A14$
If A2 = SheetName Then
Cells(ActiveCell.Row, 2) = A5$
Cells(ActiveCell.Row, 3) = A6$
Cells(ActiveCell.Row, 4) = A7$
Cells(ActiveCell.Row, 5) = A8$
Cells(ActiveCell.Row, 6) = A12$
Close #1
Exit Sub
End If
Wend
Close #1
End Sub[/vba]
Last edited by Aussiebear; 07-16-2011 at 02:53 PM.
Reason: Added vba tags to code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules