![]() |
macro to delete specific row with queries embedded
Hi everyone
im trying to compile a excel sheet that retrieves data from yahoo finance i made 12 web queries (each one has 66 rows of data),each one for a different page of data for the same company stock and i adjusted the query to refresh for query 1 (row 1 -66) ,query 2 (row 67-133)...and so on i also placed a macro to delete rows that have 0 data or have words as data but somehow executing the macro deletes the row as well as the embedded webquery in the sheet and if i refresh the query again ,the data is messed up,much shorter than before as compered with if i dont delete . Please advise me on how to tweak this as it is pretty urgent (need it by next week) if u want i can send u the excel file to check Thank you so much Regards Mervyn macro is as below Sub aaacut() ' ' aaacut Macro ' Macro recorded 07/11/2006 by Mervyn Teo ' Call DeleteRows End Sub ' Public Sub DeleteRows() Dim R As Long Dim C As Range Dim Rng As Range On Error GoTo EndMacro Application.ScreenUpdating = False Application.Calculation = xlCalculationManual If Selection.Rows.Count 1 Then Set Rng = Selection Else Set Rng = ActiveSheet.UsedRange.Rows End If For R = Rng.Rows.Count To 1 Step -1 If Cells(R, "C").Value = "" Then Rng.Rows(R).EntireRow.Delete ElseIf Cells(R, "C").Value = "High" Then Rng.Rows(R).EntireRow.Delete End If Next R EndMacro: Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub |
All times are GMT +1. The time now is 06:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com