Wrap Text

markh1182

New Member
Joined
Apr 25, 2006
Messages
48
If in a spreadsheet you need to count down 60 rows, when someone wraps text and it goes onto a second line, is there a way to get a macro to count the 2nd line as a row, as therefore instead of going to row 60, it would count to row 59?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hmmm

I would have thought so, yes, but it would require you to search each string in the cells for a carriage return character....
 
Upvote 0
How about using the rowheight property? Assuming the rows are equal heights (default 12.75)

Code:
Sub Macro1()

tHeight = 0
For n = 1 To 60
x = Range("A" & n).RowHeight
tHeight = tHeight + x
Next

tHeight = (tHeight / 12.75)

'rows to exclude
exRows = tHeight - 60

Range("A1:A" & (60 - exRows)).Select


End Sub

Hope it helps

PS excuse my messy coding!!
 
Upvote 0
Gaj - that's an interesting way of tackling the problem. It is then dependent on the sheet formatting. Mark, maybe it would help us if you could explain exactly why you are wanting to do this?
 
Upvote 0
This needs to be done as the I need to be able to set the page setup correctly. The users want to be able to wrap text, but every equivalent to 60 rows height I need to put Page Summary at the bottom of the page and have a page break as this spreadsheet needs to be set in a specific style.
 
Upvote 0

Forum statistics

Threads
1,218,842
Messages
6,144,796
Members
450,567
Latest member
Mplz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top