Hello,
Firstly - I would like to apologises to everyone out there who as help me in the past, and for not showing my thanks in the correct manner. I'm fully up to speed with the Star system now!
I have the following code that works great, but it as to run some macro that take a lot of time to do there stuff (especially the Material Resourse macro).
The thing is I don't really need to run this macro if the cell value in column I is "".
The code basically takes quantities from col E and paste them to col X - it then deletes them from E - then starting from X3 it copies the quantity to E3. It then moves to Y3 and copies some information and pastes it to another sheet (Coins).
The macro then kick in.
After some copy and pasting the code then returns to e3 and deletes the quantity and skips over to X4 and repeats the process.
I hope I explained myself OK.
Here is a copy of the code:
Sub CoinsRoutine()
'Select Quantity Column & Copy
Range("e3"
.Select
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.Copy
'Paste Quantities To Column X
Range("x3"
.Select
ActiveSheet.Paste
'Delete Quantities From Column E
Range("e3"
.Select
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.ClearContents
'Start Loop to Paste Quantities One at a time from Col X to Col E
Range("x3"
.Select
Do Until ActiveCell.Value = ""
ActiveCell.Copy Destination:=ActiveCell.Offset(0, -19)
'Copy Item Info ie Volume, Page, Item etc... & Paste On Coins Sheet
ActiveCell.Offset(0, 1).Select
Selection.Copy
Sheets("Coins"
.Select
Columns("I:I"
.Select
Selection.Find(What:="100", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
ActiveCell.Select
ActiveCell.Offset(0, -8).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Run Labour Resourse Macro
Application.Run "'4203BoQ.xls'!LabourResourse"
'Run Plant Resourse Macro
Application.Run "'4203BoQ.xls'!PlantResourse"
'Run Material Resourse Macro
Application.Run "'4203BoQ.xls'!MaterialResourse"
'Run Subs Resourse Macro
Application.Run "'4203BoQ.xls'!SubResourse"
'Sort Coins Report
Sheets("Coins Report"
.Select
Range("A1:H1308"
.Select
Selection.Sort Key1:=Range("H2"
, Order1:=xlDescending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
Range("A2"
.Select
'Copy Resourses
Sheets("Coins Report"
.Select
LRow = Range("A65536"
.End(xlUp).Row
LCol = Range("h2"
.Column
Range(Cells(2, 1), Cells(LRow, LCol)).Select
Selection.Copy
'Paste Resourses To Coins sheet
Sheets("Coins"
.Select
Columns("I:I"
.Select
Selection.Find(What:="100", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Continue loop to copy quants one at a time
Sheets("BoQ"
.Select
ActiveCell.Offset(0, -20).ClearContents
ActiveCell.Offset(1, -1).Select
Loop
'Select Quants In Column X & Paste Back To Column E
Range("x3"
.Select
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.Copy
Range("e3"
.Select
ActiveSheet.Paste
'Delete Quants From Col X
Range("x3"
.Select
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.ClearContents
Range("e3"
.Select
End Sub
Here is also a copy of the Material Resourse macro should you need it.
Sub MaterialResourse()
' MaterialResourse Macro
' Macro recorded 11/08/2003 by Andrew Elliott
'
'
Sheets("Material"
.Select
[k1] = [l1]
Range("c2:c820"
.Select
Selection.Copy
[j2].Select
Selection.PasteSpecial Paste:=xlValues
Dim R As Long
'Loop till R = 820
For R = 2 To 820
'Cells(RowNumber,ColNumber)
Cells(R, 3).FormulaR1C1 = ""
Cells(R, 12).Value = Cells(R, 11).Value
Cells(R, 3).Value = Cells(R, 10).Value
Next R
[a2].Select
Sheets("Mats Report"
.Select
Range("A3:k821"
.Select
Selection.Sort Key1:=[k3] _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
[a2].Select
End Sub
Thankyou in advance.
Andrew
Firstly - I would like to apologises to everyone out there who as help me in the past, and for not showing my thanks in the correct manner. I'm fully up to speed with the Star system now!
I have the following code that works great, but it as to run some macro that take a lot of time to do there stuff (especially the Material Resourse macro).
The thing is I don't really need to run this macro if the cell value in column I is "".
The code basically takes quantities from col E and paste them to col X - it then deletes them from E - then starting from X3 it copies the quantity to E3. It then moves to Y3 and copies some information and pastes it to another sheet (Coins).
The macro then kick in.
After some copy and pasting the code then returns to e3 and deletes the quantity and skips over to X4 and repeats the process.
I hope I explained myself OK.
Here is a copy of the code:
Sub CoinsRoutine()
'Select Quantity Column & Copy
Range("e3"
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.Copy
'Paste Quantities To Column X
Range("x3"
ActiveSheet.Paste
'Delete Quantities From Column E
Range("e3"
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.ClearContents
'Start Loop to Paste Quantities One at a time from Col X to Col E
Range("x3"
Do Until ActiveCell.Value = ""
ActiveCell.Copy Destination:=ActiveCell.Offset(0, -19)
'Copy Item Info ie Volume, Page, Item etc... & Paste On Coins Sheet
ActiveCell.Offset(0, 1).Select
Selection.Copy
Sheets("Coins"
Columns("I:I"
Selection.Find(What:="100", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
ActiveCell.Select
ActiveCell.Offset(0, -8).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Run Labour Resourse Macro
Application.Run "'4203BoQ.xls'!LabourResourse"
'Run Plant Resourse Macro
Application.Run "'4203BoQ.xls'!PlantResourse"
'Run Material Resourse Macro
Application.Run "'4203BoQ.xls'!MaterialResourse"
'Run Subs Resourse Macro
Application.Run "'4203BoQ.xls'!SubResourse"
'Sort Coins Report
Sheets("Coins Report"
Range("A1:H1308"
Selection.Sort Key1:=Range("H2"
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
Range("A2"
'Copy Resourses
Sheets("Coins Report"
LRow = Range("A65536"
LCol = Range("h2"
Range(Cells(2, 1), Cells(LRow, LCol)).Select
Selection.Copy
'Paste Resourses To Coins sheet
Sheets("Coins"
Columns("I:I"
Selection.Find(What:="100", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Continue loop to copy quants one at a time
Sheets("BoQ"
ActiveCell.Offset(0, -20).ClearContents
ActiveCell.Offset(1, -1).Select
Loop
'Select Quants In Column X & Paste Back To Column E
Range("x3"
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.Copy
Range("e3"
ActiveSheet.Paste
'Delete Quants From Col X
Range("x3"
If ActiveCell.End(xlDown).Row < 65528 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End If
Selection.ClearContents
Range("e3"
End Sub
Here is also a copy of the Material Resourse macro should you need it.
Sub MaterialResourse()
' MaterialResourse Macro
' Macro recorded 11/08/2003 by Andrew Elliott
'
'
Sheets("Material"
[k1] = [l1]
Range("c2:c820"
Selection.Copy
[j2].Select
Selection.PasteSpecial Paste:=xlValues
Dim R As Long
'Loop till R = 820
For R = 2 To 820
'Cells(RowNumber,ColNumber)
Cells(R, 3).FormulaR1C1 = ""
Cells(R, 12).Value = Cells(R, 11).Value
Cells(R, 3).Value = Cells(R, 10).Value
Next R
[a2].Select
Sheets("Mats Report"
Range("A3:k821"
Selection.Sort Key1:=[k3] _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
[a2].Select
End Sub
Thankyou in advance.
Andrew