Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Delete Row Based On Row Height

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Delete Row Based On Row Height

Also: I am using Excel 2002 SP-2.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Delete Row Based On Row Height

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Delete Row Based On Row Height

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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Delete Row Based On Row Height

AA

That's actually a typo, it was meant to be

lLastRow=Range("A65536").End(xlUp).Row

Type it so many times I'm getting lazy, sorry to all

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"anonymousA" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Delete Row Based On Row Height

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Delete Row Based On Row Height

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Delete Row Based On Row Height

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Delete Row Based On Row Height

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Delete Row Based On Row Height

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Row Height stopped growing and Auot-Fit Row Height does not work PSULionRP Excel Discussion (Misc queries) 0 May 19th 09 07:59 PM
Need help setting the worksheet header/Footer margins based on string height? Doug Excel Discussion (Misc queries) 0 August 20th 06 02:05 AM
Resizing row height to dynamically fit height of text box Jon Excel Discussion (Misc queries) 1 August 8th 05 01:37 PM
how to change the raw height automatically based on the content si ASQ Excel Discussion (Misc queries) 1 July 17th 05 10:04 AM
Set new row height based on current height puffy Excel Programming 2 January 14th 04 12:44 AM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"