beantownmt
New Member
- Joined
- Aug 29, 2011
- Messages
- 11
Hi all.
I have a macro to import data from sheet1 to JeffsTransp.
The Data imports fine and the calculation works. The only problem is the calculations will only work on the first row of data? How can I get the calculations to work on all the imported data.
Here's the code I'm using;
Copy and Paste Code
'B=B C=C D=D E=E F=L G=E H=F I=G K=H L=I M=J N=O T=M.
Application.EnableEvents = False
r = rngCell.Row
'u = Sheets("JeffsTransp").Range("B" & Rows.Count).End(xlUp).Row + 1
Sheets("JeffsTransp").Rows(u & ":" & u).Insert Shift:=xlDown
Sheets("JeffsTransp").Range("B" & u) = Sheets("Sheet1").Range("B" & r)
Sheets("JeffsTransp").Range("C" & u) = Sheets("Sheet1").Range("C" & r)
Sheets("JeffsTransp").Range("D" & u) = Sheets("Sheet1").Range("D" & r)
Sheets("JeffsTransp").Range("F" & u) = Sheets("Sheet1").Range("L" & r)
Sheets("JeffsTransp").Range("G" & u) = Sheets("Sheet1").Range("E" & r)
Sheets("JeffsTransp").Range("H" & u) = Sheets("Sheet1").Range("F" & r)
Sheets("JeffsTransp").Range("I" & u) = Sheets("Sheet1").Range("G" & r)
Sheets("JeffsTransp").Range("K" & u) = Sheets("Sheet1").Range("H" & r)
Sheets("JeffsTransp").Range("L" & u) = Sheets("Sheet1").Range("I" & r)
Sheets("JeffsTransp").Range("M" & u) = Sheets("Sheet1").Range("J" & r)
Sheets("JeffsTransp").Range("N" & u) = Sheets("Sheet1").Range("O" & r)
Sheets("JeffsTransp").Range("T" & u) = Sheets("Sheet1").Range("M" & r)
Application.CalculateFull
Application.EnableEvents = True
u = u + 1
'rngStart.PasteSpecial (xlPasteValuesAndNumberFormats)
Next rngCell
'restore screen updating
MsgBox "Limo Wiz Trips to be Imported = " & n
Application.EnableEvents = False
Application.Calculation = xlAutomatic
Range("A16").Formula = "=A4+A15+1"
Range("O16").Formula = "=L16*N16"
Range("Q16").Formula = "=L16+O16"
Range("S16").Formula = "=SUM(L16+M16)*R16"
Range("U16").Formula = "=S16*T16"
Range("V16").Formula = "=SUM(Q16-S16-U16)+P16"
Application.CalculateFull
Application.EnableEvents = True
Application.ScreenUpdating = True
Exit Sub
'error handler
ErrHnd:
' ErrClear
'restore screen updating
Application.ScreenUpdating = True
End Sub
Any Help will be greatly appreciated
I have a macro to import data from sheet1 to JeffsTransp.
The Data imports fine and the calculation works. The only problem is the calculations will only work on the first row of data? How can I get the calculations to work on all the imported data.
Here's the code I'm using;
Copy and Paste Code
'B=B C=C D=D E=E F=L G=E H=F I=G K=H L=I M=J N=O T=M.
Application.EnableEvents = False
r = rngCell.Row
'u = Sheets("JeffsTransp").Range("B" & Rows.Count).End(xlUp).Row + 1
Sheets("JeffsTransp").Rows(u & ":" & u).Insert Shift:=xlDown
Sheets("JeffsTransp").Range("B" & u) = Sheets("Sheet1").Range("B" & r)
Sheets("JeffsTransp").Range("C" & u) = Sheets("Sheet1").Range("C" & r)
Sheets("JeffsTransp").Range("D" & u) = Sheets("Sheet1").Range("D" & r)
Sheets("JeffsTransp").Range("F" & u) = Sheets("Sheet1").Range("L" & r)
Sheets("JeffsTransp").Range("G" & u) = Sheets("Sheet1").Range("E" & r)
Sheets("JeffsTransp").Range("H" & u) = Sheets("Sheet1").Range("F" & r)
Sheets("JeffsTransp").Range("I" & u) = Sheets("Sheet1").Range("G" & r)
Sheets("JeffsTransp").Range("K" & u) = Sheets("Sheet1").Range("H" & r)
Sheets("JeffsTransp").Range("L" & u) = Sheets("Sheet1").Range("I" & r)
Sheets("JeffsTransp").Range("M" & u) = Sheets("Sheet1").Range("J" & r)
Sheets("JeffsTransp").Range("N" & u) = Sheets("Sheet1").Range("O" & r)
Sheets("JeffsTransp").Range("T" & u) = Sheets("Sheet1").Range("M" & r)
Application.CalculateFull
Application.EnableEvents = True
u = u + 1
'rngStart.PasteSpecial (xlPasteValuesAndNumberFormats)
Next rngCell
'restore screen updating
MsgBox "Limo Wiz Trips to be Imported = " & n
Application.EnableEvents = False
Application.Calculation = xlAutomatic
Range("A16").Formula = "=A4+A15+1"
Range("O16").Formula = "=L16*N16"
Range("Q16").Formula = "=L16+O16"
Range("S16").Formula = "=SUM(L16+M16)*R16"
Range("U16").Formula = "=S16*T16"
Range("V16").Formula = "=SUM(Q16-S16-U16)+P16"
Application.CalculateFull
Application.EnableEvents = True
Application.ScreenUpdating = True
Exit Sub
'error handler
ErrHnd:
' ErrClear
'restore screen updating
Application.ScreenUpdating = True
End Sub
Any Help will be greatly appreciated