blaksnm
Well-known Member
- Joined
- Dec 15, 2009
- Messages
- 554
- Office Version
- 365
- Platform
- Windows
Hi
My Excel Database goes like this (simplified):
Column A: Project number
Column B: Calculated Project Cost
Range ("Formula")
Number of rows: pretty much (+20 000)
Now I want to recalculate the values Project Cost (Col B) for some Projects (e.g. All Project except "BASIC") by first using formula - then paste as value (Whole column B afterwards)
"BASIC" Project Cost should remain as original
By using the macro below I sort of manage to do the trick, but it takes all the time in the world!
So I hope there is a much more smoother way to do this
Could anyone please help me on this one?
Sub LoopTest()
Sheets("Database").Select
Dim Project
Project= "BASIC"
Range("Formula").Copy
Range("A1").Select
For MY_ROWS = Range("a" & Rows.Count).End(xlUp).Row To 2 Step -1
If Not (IsError(Range("b" & MY_ROWS).Value)) Then
If Range("a" & MY_ROWS).Value <> Project Then
Range("b" & MY_ROWS).PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End If
Next MY_ROWS
End Sub
My Excel Database goes like this (simplified):
Column A: Project number
Column B: Calculated Project Cost
Range ("Formula")
Number of rows: pretty much (+20 000)
Now I want to recalculate the values Project Cost (Col B) for some Projects (e.g. All Project except "BASIC") by first using formula - then paste as value (Whole column B afterwards)
"BASIC" Project Cost should remain as original
By using the macro below I sort of manage to do the trick, but it takes all the time in the world!
So I hope there is a much more smoother way to do this
Could anyone please help me on this one?
Sub LoopTest()
Sheets("Database").Select
Dim Project
Project= "BASIC"
Range("Formula").Copy
Range("A1").Select
For MY_ROWS = Range("a" & Rows.Count).End(xlUp).Row To 2 Step -1
If Not (IsError(Range("b" & MY_ROWS).Value)) Then
If Range("a" & MY_ROWS).Value <> Project Then
Range("b" & MY_ROWS).PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End If
Next MY_ROWS
End Sub