Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50061

VB Macro help - formula for 45000 lines..

$
0
0
Dear All,

I have a VB coding to execute the formulas for three columns for 45000 line items but when i execute this function the system is getting hanged due to huge line items. Kindly look into this issue and let me know if there is any other alternative coding so that this function can be executed without any flaws. I appreciate you help...

Code:

Private Sub CommandButton1_Click()
Worksheets("ABC").Activate
Range("M3:O10").ClearContents
Range("M2").Select
Range("M3:M10").Formula = "=IF(RC[-2]="""","""",IF(AND(HOUR(RC[-2])>=0,HOUR(RC[-2])<=7),DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]))-1,DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]))))"
Range("N3:N45000").FormulaR1C1 = "=LEFT(RC[-6],2)"
Range("O3:O45000").FormulaR1C1 = "=IF(RC[-11]<>"""",IF((COUNTIF(R[-1]C4:R3C[-11],RC[-11])>=1),""Yes"",""No""),"""")"

Range("M3:O45000").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub

Regards,
Srikanth M :)

Viewing all articles
Browse latest Browse all 50061

Trending Articles