macro is to update column 13 and 14 of worksheet "Voice BB Pending"as per column 2 and 3 of "Activit

S

San

Dear all,
I am tired of running below macro in Excel 2007, but no use. Please
can anyone help me urgently as my project is held up because of this
silly macro.

Purpose of this macro is to update column 13 and 14 of worksheet
"Voice BB Pending" as per column 2 and 3 of "Activity log" .

"Voice BB Pending" is master sheet and Activity log is daily log
sheet. column 1 of these sheets contain the order numbers whose
updates need to be copied from column 2, 3 of activity log sheet to
column 13, 14 of voice bb sheet.
------------------------------------------------------------------------------------------
Activity sheet is as
A B
C D
Order number Update Dependency Name

Voice BB sheet is as
A M
N
order number Dependency Update

===================================================================
Sub Caller()
Set shtSource = Worksheets("activity log")
lngLastS = shtSource.Cells(shtSource.Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
nehaAll "Voice BB pending"
nehaAll "Activated"
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Set shtSource = Nothing
End Sub


Sub nehaAll(strTarget As String)
Dim shtTarget As Worksheet
Dim lngLoopT As Long
Dim lngLoopS As Long
Dim lngLastT As Long
Set shtTarget = Worksheets(strTarget)
lngLastT = shtTarget.Cells(shtTarget.Rows.Count, 1).End(xlUp).Row
For lngLoopS = 2 To lngLastS
For lngLoopT = 3 To lngLastT
Sheets("activity log").Cells(lngLoopS, 4).Select
If shtSource.Cells(lngLoopS, 1).Value =
shtTarget.Cells(lngLoopT, 1).Value Then
shtTarget.Cells(lngLoopT, 13).Value =
shtSource.Cells(lngLoopS, 3).Value
shtTarget.Cells(lngLoopT, 14).Value =
shtTarget.Cells(lngLoopT, 14).Value & vbNewLine & CStr(Date) & ";" &
shtSource.Cells(lngLoopS, 4).Value & ";" & shtSource.Cells(lngLoopS,
2).Value & "***Dependency:-" & shtSource.Cells(lngLoopS, 3)

End If
Next lngLoopT
Next lngLoopS
Set shtTarget = Nothing
End Sub
=============================================
 
S

Scossa

cut
  For lngLoopS = 2 To lngLastS

How lngLastS is decalred?
Is set in Caller()
lngLastS = shtSource.Cells(shtSource.Rows.Count, 1).End(xlUp).Row

but is used in nehaAll()

Bye!
Scossa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top