Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings.
I am attempting to create a macro which will automatically delete entire rows based on height. For example, I have a worksheet which contains rows of two different heights. I need a script which will delete every row with a height of 27.75 I have a limited knowledge of VBA and am having difficulty creating this macro. Any and all help is sincerely appreciated. Thanks in advance! - Kobi |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Also: I am using Excel 2002 SP-2.
|
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kobi
Try this Sub deleterowwith2775() Dim llastrow As Long, x As Long llastrow = Range("A65536").Row For x = llastrow To 1 Step -1 If Range("A" & x).RowHeight = 27.75 Then Range("A" & x).EntireRow.Delete End If Next x End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS wrote in message oups.com... Greetings. I am attempting to create a macro which will automatically delete entire rows based on height. For example, I have a worksheet which contains rows of two different heights. I need a script which will delete every row with a height of 27.75 I have a limited knowledge of VBA and am having difficulty creating this macro. Any and all help is sincerely appreciated. Thanks in advance! - Kobi |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
in your code, it's not really necessary to add "llastrow" because for sure 65536 is definetely the last row of a spreadsheet . If you want to speed up your code, it would be interesting to determine which row is the last one in a specific column.. According to this, you could write ( but there're other solutions) llastrow=range("A655536").end(xlup).row Friendly, So long "Nick Hodge" a écrit dans le message de news: ... Kobi Try this Sub deleterowwith2775() Dim llastrow As Long, x As Long llastrow = Range("A65536").Row For x = llastrow To 1 Step -1 If Range("A" & x).RowHeight = 27.75 Then Range("A" & x).EntireRow.Delete End If Next x End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS wrote in message oups.com... Greetings. I am attempting to create a macro which will automatically delete entire rows based on height. For example, I have a worksheet which contains rows of two different heights. I need a script which will delete every row with a height of 27.75 I have a limited knowledge of VBA and am having difficulty creating this macro. Any and all help is sincerely appreciated. Thanks in advance! - Kobi |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
write down those instructions in a module of your VBA project Sub deleterow() For I = 65536 To 1 Step -1 If Cells(I, 1).RowHeight = 27.75 Then Cells(I, 1).EntireRow.Delete Next End Sub All your spreadsheet will be scanned. so long a écrit dans le message de news: ... Greetings. I am attempting to create a macro which will automatically delete entire rows based on height. For example, I have a worksheet which contains rows of two different heights. I need a script which will delete every row with a height of 27.75 I have a limited knowledge of VBA and am having difficulty creating this macro. Any and all help is sincerely appreciated. Thanks in advance! - Kobi |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Something like: If ActiveCell.RowHeight = 22.5 Then ActiveCell.EntireRow.Delete HTH Charles wrote in message oups.com... Greetings. I am attempting to create a macro which will automatically delete entire rows based on height. For example, I have a worksheet which contains rows of two different heights. I need a script which will delete every row with a height of 27.75 I have a limited knowledge of VBA and am having difficulty creating this macro. Any and all help is sincerely appreciated. Thanks in advance! - Kobi |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
THANKS for the quick responses all!
I am using anonymousA's "deleterow" code and am having trouble getting it work properly the worksheet I mentioned earlier - it runs, does not error out, and does not delete the rows it is supposed to - it seems to not do anything. However, I copied and pasted the main worksheet into a NEW worksheet, adjusted some of the row heights to 27.75 in the new worksheet, ran the macro, and it did the job perfectly. So now, a new question: why doesn't it work properly in the main worksheet? Perhaps some attributes need to be altered in the main worksheet so that it can work properly? Some background: the main worksheet originated from a report generating program called Impromptu. Impromptu allows you to save the report as an .XLS file, which I did. In addition: both worksheets I am referring to are in the same workbook. Any ideas? THANKS AGAIN! - Kobi |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry, Kobi, but I don't know why it's not running on your main worksheet as
I can't how this one's built. a écrit dans le message de news: ... THANKS for the quick responses all! I am using anonymousA's "deleterow" code and am having trouble getting it work properly the worksheet I mentioned earlier - it runs, does not error out, and does not delete the rows it is supposed to - it seems to not do anything. However, I copied and pasted the main worksheet into a NEW worksheet, adjusted some of the row heights to 27.75 in the new worksheet, ran the macro, and it did the job perfectly. So now, a new question: why doesn't it work properly in the main worksheet? Perhaps some attributes need to be altered in the main worksheet so that it can work properly? Some background: the main worksheet originated from a report generating program called Impromptu. Impromptu allows you to save the report as an .XLS file, which I did. In addition: both worksheets I am referring to are in the same workbook. Any ideas? THANKS AGAIN! - Kobi |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When you said you made some changes to the "Test" wbk, What changes?
Specifically, did you change any heights? If not, this is a guess: the report generator may have made the row height something like 27.75443 which is rounded off when you look at the height. If such is the case you might try something like .rowheight26 in your if statement. " wrote: THANKS for the quick responses all! I am using anonymousA's "deleterow" code and am having trouble getting it work properly the worksheet I mentioned earlier - it runs, does not error out, and does not delete the rows it is supposed to - it seems to not do anything. However, I copied and pasted the main worksheet into a NEW worksheet, adjusted some of the row heights to 27.75 in the new worksheet, ran the macro, and it did the job perfectly. So now, a new question: why doesn't it work properly in the main worksheet? Perhaps some attributes need to be altered in the main worksheet so that it can work properly? Some background: the main worksheet originated from a report generating program called Impromptu. Impromptu allows you to save the report as an .XLS file, which I did. In addition: both worksheets I am referring to are in the same workbook. Any ideas? THANKS AGAIN! - Kobi |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
gocush wrote:
If not, this is a guess: the report generator may have made the row height something like 27.75443 which is rounded off when you look at the height. If such is the case you might try something like .rowheight26 in your if statement. Gocush, THAT DID IT! Thanks so much! Impressed, - Kobi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Row Height stopped growing and Auot-Fit Row Height does not work | Excel Discussion (Misc queries) | |||
Need help setting the worksheet header/Footer margins based on string height? | Excel Discussion (Misc queries) | |||
Resizing row height to dynamically fit height of text box | Excel Discussion (Misc queries) | |||
how to change the raw height automatically based on the content si | Excel Discussion (Misc queries) | |||
Set new row height based on current height | Excel Programming |