Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using variable in the excel cell formatting 1

Status
Not open for further replies.

Davide77

Technical User
Mar 6, 2003
166
CH
Hallo
I'm trying to format some excel cells depending on some criteria.
For example I want that a specific number of rows is set to a certain height. The problem is that the range of rows can change. So I was thinking to use some variables instead of numbers:

.Rows("1:3").RowHeight = 36

This will set the height of row 1,2 and 3 to 36. Now I calculated some value and stored in variables:

start = 2
end = 5

and I would like to use this instead of the numbers:

.Rows(start:end).RowHeight = 36

but it doesn't work, at this point I don't know if I'm doing something completely wrong or if it's just a matter of syntax...
 
.Rows(start & ":" & end).RowHeight = 36

Rgds, Geoff
[blue]Experience is something you don't get until just after you need it[/blue]
We want to help [red]you[/red] Help us by reading this FAQ 1st faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top