Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
1) In a range of cells (A1:B119) there are empty lines (e.g. A1:B1) which I
want to delete in a Macro. Is this possible? 2) When I sort a.m. range of cells (A1:B119), containing text, the empty lines are on top, unless I sort descending. A way out of this other than manually delete the emtpty cells? Hence question no. 1 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() "fak119" wrote in message ... 1) In a range of cells (A1:B119) there are empty lines (e.g. A1:B1) which I want to delete in a Macro. Is this possible? iLastRow = Cells(Rows.Count,"A").End(xlUp).Row For i = iLastRow to 1 If Cells(i,"A").Value = "" And Cells(i,"B").Value = "" Then Rows(i).delete End If Next i 2) When I sort a.m. range of cells (A1:B119), containing text, the empty lines are on top, unless I sort descending. A way out of this other than manually delete the emtpty cells? Hence question no. 1 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you, Bob, I´m sure this would help.
Unfortunately I am a very poor Macro programmer and I have never done one like that before (loops, etc.) Felix "Bob Phillips" wrote: "fak119" wrote in message ... 1) In a range of cells (A1:B119) there are empty lines (e.g. A1:B1) which I want to delete in a Macro. Is this possible? iLastRow = Cells(Rows.Count,"A").End(xlUp).Row For i = iLastRow to 1 If Cells(i,"A").Value = "" And Cells(i,"B").Value = "" Then Rows(i).delete End If Next i 2) When I sort a.m. range of cells (A1:B119), containing text, the empty lines are on top, unless I sort descending. A way out of this other than manually delete the emtpty cells? Hence question no. 1 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Just wrap it in a macro.
First, select the sheet you want to work on. Then go to the VBIDE (Alt-F11), insert a code module (InsertModule) and paste the code below Sub ProcessData() iLastRow = Cells(Rows.Count,"A").End(xlUp).Row For i = iLastRow to 1 If Cells(i,"A").Value = "" And Cells(i,"B").Value = "" Then Rows(i).delete End If Next i End Sub Go backto Excel (Alt-F11), get the list of macros (Alt-F8), select Processdata from the list and hit the Run button. -- --- HTH Bob (change the xxxx to gmail if mailing direct) "fak119" wrote in message ... Thank you, Bob, I´m sure this would help. Unfortunately I am a very poor Macro programmer and I have never done one like that before (loops, etc.) Felix "Bob Phillips" wrote: "fak119" wrote in message ... 1) In a range of cells (A1:B119) there are empty lines (e.g. A1:B1) which I want to delete in a Macro. Is this possible? iLastRow = Cells(Rows.Count,"A").End(xlUp).Row For i = iLastRow to 1 If Cells(i,"A").Value = "" And Cells(i,"B").Value = "" Then Rows(i).delete End If Next i 2) When I sort a.m. range of cells (A1:B119), containing text, the empty lines are on top, unless I sort descending. A way out of this other than manually delete the emtpty cells? Hence question no. 1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to delete a group of CELLS | Excel Discussion (Misc queries) | |||
Delete Row If Empty Macro | Excel Discussion (Misc queries) | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Counting empty cells within a range of cells | New Users to Excel | |||
Macro to copy value in empty cells | Excel Discussion (Misc queries) |