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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

patrickmuldoon99

Active Member
Joined
Jun 27, 2006
Messages
345
Hmmm

I would have thought so, yes, but it would require you to search each string in the cells for a carriage return character....
 

gaj104

Well-known Member
Joined
Nov 9, 2002
Messages
864
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!!
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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?
 

markh1182

New Member
Joined
Apr 25, 2006
Messages
48
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.
 

Forum statistics

Threads
1,137,367
Messages
5,681,075
Members
419,950
Latest member
BeckiJae

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
Top