Hi,
I'm using a VBA code that copy reports. but the code have 2 conditions
Condition 1 -> If greater or less than
Condition 2 -> Sort report by descending Date (*)
Condition 2 means that for example: if perhaps i've copy yesterday report (is going to have yesterday date) So when i run the code for today it will scroll down yesterday report range and it will copy the the new one on top of yesterday report. then at all the time the report will display many reports with descending date.
What i need is to eliminate the condition 1, because i feel that its take longer and i think is not necessary anymore. I've try but i'm getting error , i might missing a word, point, comma or something.
This is the code with correct range.
Note: the condition 1 problem start with value greater than >5 and less than <100
Thanks in advance
I'm using a VBA code that copy reports. but the code have 2 conditions
Condition 1 -> If greater or less than
Condition 2 -> Sort report by descending Date (*)
Condition 2 means that for example: if perhaps i've copy yesterday report (is going to have yesterday date) So when i run the code for today it will scroll down yesterday report range and it will copy the the new one on top of yesterday report. then at all the time the report will display many reports with descending date.
What i need is to eliminate the condition 1, because i feel that its take longer and i think is not necessary anymore. I've try but i'm getting error , i might missing a word, point, comma or something.
This is the code with correct range.
Note: the condition 1 problem start with value greater than >5 and less than <100
Code:
Sub STRep_1()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Sheets("ST1").Select
Dim j As Long, lr As Long
For j = 4 To 83
If Cells(j, 359).Value > 5 And Cells(j, 359).Value < 100 Then _
Cells(Rows.Count, 147).End(xlUp).Offset(1).Resize(, 50).Value = Cells(j, 359).Resize(, 50).Value
Next j
lr = Range("EV" & Rows.Count).End(xlUp).Row
With Range("EQ2:GN" & lr)
.Sort key1:=[EV3], order1:=xlDescending, Header:=xlYes
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End With
End Sub
Thanks in advance
Last edited: