![]() |
|
#1
|
|||
|
|||
![]() Quote:
Your macro worked PERFECTLY!! Thank you very much. Regarding deleting extra rows, you will see an XLS file attached that includes the macro working for July 2006 (and I recorded the macro according to it) and June 2005. There will be 4 sheets, the first and the third sheets ("07_2006_BF" and (06_2005_BF") are the data before the macro while the second and the fourth sheets ("07_2006_AF" and "06_2005_AF") are the data after applying the macro. Also you will see a TXT file attached that includes the macro I recorded. Will you gonna edit the macros so they will stop working when they face an empty cell or you will make a new macro to delete the extra rows? And another thing, when I apply "macro2" a message appears to confirm pasting the cells over the existing cells and I should hit OK, how can I edit the macro so it will hit OK instead of me? Many thanks Bjorn for your GREAT effort with me, you really saved a lot of my time. ![]() Last edited by tareq; 01-26-2011 at 01:42 PM. |
#2
|
|||
|
|||
![]()
Hi,
try this around your macros: Sub macro xx() Application.DisplayAlerts = False (please your existing code here) Application.DisplayAlerts=True End sub You can also place these commands just around the part of the code that creates these kind of messages (how to find them? => Press Alt-F11 to see your macro, place cursor at macro beginning, run the macro "step by step" by pressing F8 over and over again, until you see what code creates this message). Kind regards Bjorn |
#3
|
|||
|
|||
![]() Quote:
![]() |
#4
|
|||
|
|||
![]()
Hi again,
after you have run your recorded macro's try this macro (still before the macro I wrote for you). It will delete rows where there is data in column "E" but no data in column "D". I think we are through now with all issues!! ![]() Kind regards Bjorn PS. Have a look at the code. As you see it is not so complicated with some simple macro's, why not try to learn? It started learning just some few months ago, just by googling around ![]() Sub FixShortMonth() Application.ScreenUpdating = False Dim rownum As Long rownum = 174 Do Until Cells(rownum, 5).Value = "" If Cells(rownum, 4).Value = "" Then Cells(rownum, 1).EntireRow.Delete Else rownum = rownum + 1 End If Loop Application.ScreenUpdating = False End Sub |
#5
|
|||
|
|||
![]() Quote:
Man you really helped me! The fixmonth macro worked perfectly, and the code to fix the confirmation msg also worked ![]() ![]() ![]() |
#6
|
|||
|
|||
![]()
Hi,
try this instead! Good night (at least in my part of the world :-) Kind regards Bjorn Sub FixRows() Application.ScreenUpdating = False Dim rownum As Long Dim rowhour As Long Dim CopyOffset As Long rownum = 4 rowhour = 0 Do Until Cells(rownum, 4).Value = "" And rowhour = 0 If Cells(rownum, 4).Value <> rowhour And Cells(rownum, 4).Value Mod 100 = 0 Then Cells(rownum, 1).EntireRow.Insert If rownum = 4 Then CopyOffset = 1 Else CopyOffset = -1 Cells(rownum + CopyOffset, 1).Range("A1:L1").Copy _ Destination:=Cells(rownum, 1) Cells(rownum, 4).Value = rowhour If rowhour Mod 300 = 0 Then With Cells(rownum, 5) .NumberFormat = "0" .FormulaR1C1 = "9999" .Interior.ColorIndex = 6 .Interior.Pattern = xlSolid .Borders.LineStyle = xlcontinous .Borders.Weight = xlThin .Borders.ColorIndex = xlAutomatic End With Cells(rownum, 5).Copy Destination:=Cells(rownum, 1).Range("E1:L1") End If End If rownum = rownum + 1 rowhour = rowhour + 100 If rowhour = 2400 Then rowhour = 0 Loop Application.ScreenUpdating = False End Sub |
#7
|
|||
|
|||
![]() Quote:
![]() ![]() Tareq. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wierd symbols inplace of "space", "indentation" etc | aka.bhagvanji | Word | 5 | 02-16-2012 11:50 AM |
![]() |
MShroff | Word | 8 | 01-19-2011 08:43 AM |
"Microsoft Excel Application" missing in the "Component Services" on win08 | sword.fish | Excel | 0 | 02-26-2010 02:09 PM |
How do I change the "and" to "or" with multiple Rules (and Alerts)? | bschimmel | Outlook | 0 | 11-16-2009 05:26 AM |
Saving only "DATA" on excel? No white bottom? | jrasche2003@yahoo.com | Excel | 0 | 08-07-2006 09:27 AM |