PC Review


Reply
Thread Tools Rate Thread

Column width and Row height test?

 
 
CLR
Guest
Posts: n/a
 
      1st May 2009
Hi All...
Is it possible to test a range of cells, for column widths and row heights,
(or maybe anything outside the default settings)?.......also to tell if any
rows or columns within that range are hidden or merged? Any info that can
be decerned would be appreciated.

TIA
Vaya con Dios,
Chuck, CABGx3


 
Reply With Quote
 
 
 
 
AltaEgo
Guest
Posts: n/a
 
      2nd May 2009
Below are a set of samples that should give you a starting point. There are
many variations so, try to work out what you are trying to achieve from the
sample below and ask further questions if you are stuck.
Generally speaking, what you can do with a row, you can do with a column.
Use EntireColumn instead of EntireRow.




Sub Test()

If Selection.ColumnWidth = 10 Then
MsgBox "Column Width exceeds 10."
End If
If Selection.RowHeight > 10 Then
MsgBox "Row Height exceeds 10."
End If

'if A2 row is hidden
'set a row height according to contents
If Range("A2").EntireRow.Hidden = True Then
Range("A2").EntireRow.AutoFit
' see next sub
End If
'Is A2 merged
MsgBox Range("A2").MergeCells

End Sub

Sub HideRowIfBlank()

If Range("A2").Value & "" = "" Then
'hide the row
Range("A2").EntireRow.RowHeight = 0
Else
'unhide and size it to 25
Range("A2").EntireRow.RowHeight = 25
End If

End Sub

Sub SetA2Val()
'use to set a value in A2
'after the row is hidden
Range("A2") = 1
End Sub

As with many problems in Excel, there are other solutions.

Range("2:2").RowHeight = 12

Cells(2,1).entireRow.Autofit


Sub JustForFun()

For i = 1 To 20
Cells(i, 1).EntireRow.RowHeight = i
Cells(1, i).EntireColumn.ColumnWidth = i / 6
Next i



--
Steve

"CLR" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi All...
> Is it possible to test a range of cells, for column widths and row
> heights, (or maybe anything outside the default settings)?.......also to
> tell if any rows or columns within that range are hidden or merged? Any
> info that can be decerned would be appreciated.
>
> TIA
> Vaya con Dios,
> Chuck, CABGx3
>
>

 
Reply With Quote
 
CLR
Guest
Posts: n/a
 
      2nd May 2009
Many thanks, Steve.........
Your suggestions are a lot of help....I appreciate them.
What I'm doing is.....I've just received a new file download from an ORACLE
system in .xls, but formatted to what a ORACLE person thinks is good,
including many variable size, or hidded, columns and rows. My taks is to
massage that data into a format/program that meets our needs. I've done
this before with straight .xls files downloaded from a different computer
system, so know the ropes. I can do this one too, but must be sure they
send me a file formatted the SAME way each month, in order for my automatic
macros to work more easily. So I want to "profile" this one, and then be
able to run that "profiler" against the new file next month to see if they
have changed anything besides the data.

End goal I guess is to have a macro that will insert a new Row1 and ColumnA
and step through and insert the RowHeights and ColumnWidths for the entire
used area.

Thanks again for your help,
Vaya con Dios,
Chuck, CABGx3



"AltaEgo" <Somewhere@NotHere> wrote in message
news:(E-Mail Removed)...
> Below are a set of samples that should give you a starting point. There
> are many variations so, try to work out what you are trying to achieve
> from the sample below and ask further questions if you are stuck.
> Generally speaking, what you can do with a row, you can do with a column.
> Use EntireColumn instead of EntireRow.
>
>
>
>
> Sub Test()
>
> If Selection.ColumnWidth = 10 Then
> MsgBox "Column Width exceeds 10."
> End If
> If Selection.RowHeight > 10 Then
> MsgBox "Row Height exceeds 10."
> End If
>
> 'if A2 row is hidden
> 'set a row height according to contents
> If Range("A2").EntireRow.Hidden = True Then
> Range("A2").EntireRow.AutoFit
> ' see next sub
> End If
> 'Is A2 merged
> MsgBox Range("A2").MergeCells
>
> End Sub
>
> Sub HideRowIfBlank()
>
> If Range("A2").Value & "" = "" Then
> 'hide the row
> Range("A2").EntireRow.RowHeight = 0
> Else
> 'unhide and size it to 25
> Range("A2").EntireRow.RowHeight = 25
> End If
>
> End Sub
>
> Sub SetA2Val()
> 'use to set a value in A2
> 'after the row is hidden
> Range("A2") = 1
> End Sub
>
> As with many problems in Excel, there are other solutions.
>
> Range("2:2").RowHeight = 12
>
> Cells(2,1).entireRow.Autofit
>
>
> Sub JustForFun()
>
> For i = 1 To 20
> Cells(i, 1).EntireRow.RowHeight = i
> Cells(1, i).EntireColumn.ColumnWidth = i / 6
> Next i
>
>
>
> --
> Steve
>
> "CLR" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi All...
>> Is it possible to test a range of cells, for column widths and row
>> heights, (or maybe anything outside the default settings)?.......also to
>> tell if any rows or columns within that range are hidden or merged? Any
>> info that can be decerned would be appreciated.
>>
>> TIA
>> Vaya con Dios,
>> Chuck, CABGx3
>>
>>



 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      2nd May 2009
If it helps you any, you can set all the column widths and row heights in a
single statement for each (this will also unhide any hidden rows and/or
columns)...

ActiveSheet.Cells.ColumnWidth = 8.43
ActiveSheet.Cells.RowHeight = 12.75

Of course, you can use Worksheets("Sheet1") in place of ActiveSheet to set
these on a specific, non-active sheet if necessary.

--
Rick (MVP - Excel)


"CLR" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Many thanks, Steve.........
> Your suggestions are a lot of help....I appreciate them.
> What I'm doing is.....I've just received a new file download from an
> ORACLE system in .xls, but formatted to what a ORACLE person thinks is
> good, including many variable size, or hidded, columns and rows. My taks
> is to massage that data into a format/program that meets our needs. I've
> done this before with straight .xls files downloaded from a different
> computer system, so know the ropes. I can do this one too, but must be
> sure they send me a file formatted the SAME way each month, in order for
> my automatic macros to work more easily. So I want to "profile" this one,
> and then be able to run that "profiler" against the new file next month to
> see if they have changed anything besides the data.
>
> End goal I guess is to have a macro that will insert a new Row1 and
> ColumnA and step through and insert the RowHeights and ColumnWidths for
> the entire used area.
>
> Thanks again for your help,
> Vaya con Dios,
> Chuck, CABGx3
>
>
>
> "AltaEgo" <Somewhere@NotHere> wrote in message
> news:(E-Mail Removed)...
>> Below are a set of samples that should give you a starting point. There
>> are many variations so, try to work out what you are trying to achieve
>> from the sample below and ask further questions if you are stuck.
>> Generally speaking, what you can do with a row, you can do with a column.
>> Use EntireColumn instead of EntireRow.
>>
>>
>>
>>
>> Sub Test()
>>
>> If Selection.ColumnWidth = 10 Then
>> MsgBox "Column Width exceeds 10."
>> End If
>> If Selection.RowHeight > 10 Then
>> MsgBox "Row Height exceeds 10."
>> End If
>>
>> 'if A2 row is hidden
>> 'set a row height according to contents
>> If Range("A2").EntireRow.Hidden = True Then
>> Range("A2").EntireRow.AutoFit
>> ' see next sub
>> End If
>> 'Is A2 merged
>> MsgBox Range("A2").MergeCells
>>
>> End Sub
>>
>> Sub HideRowIfBlank()
>>
>> If Range("A2").Value & "" = "" Then
>> 'hide the row
>> Range("A2").EntireRow.RowHeight = 0
>> Else
>> 'unhide and size it to 25
>> Range("A2").EntireRow.RowHeight = 25
>> End If
>>
>> End Sub
>>
>> Sub SetA2Val()
>> 'use to set a value in A2
>> 'after the row is hidden
>> Range("A2") = 1
>> End Sub
>>
>> As with many problems in Excel, there are other solutions.
>>
>> Range("2:2").RowHeight = 12
>>
>> Cells(2,1).entireRow.Autofit
>>
>>
>> Sub JustForFun()
>>
>> For i = 1 To 20
>> Cells(i, 1).EntireRow.RowHeight = i
>> Cells(1, i).EntireColumn.ColumnWidth = i / 6
>> Next i
>>
>>
>>
>> --
>> Steve
>>
>> "CLR" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi All...
>>> Is it possible to test a range of cells, for column widths and row
>>> heights, (or maybe anything outside the default settings)?.......also to
>>> tell if any rows or columns within that range are hidden or merged? Any
>>> info that can be decerned would be appreciated.
>>>
>>> TIA
>>> Vaya con Dios,
>>> Chuck, CABGx3
>>>
>>>

>
>


 
Reply With Quote
 
CLR
Guest
Posts: n/a
 
      3rd May 2009
Thanks for that info Rick........don't need it right now, but will keep it
for my stash for sure........appreciate your response.

Vaya con Dios,
Chuck, CABGx3

"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If it helps you any, you can set all the column widths and row heights in
> a single statement for each (this will also unhide any hidden rows and/or
> columns)...
>
> ActiveSheet.Cells.ColumnWidth = 8.43
> ActiveSheet.Cells.RowHeight = 12.75
>
> Of course, you can use Worksheets("Sheet1") in place of ActiveSheet to set
> these on a specific, non-active sheet if necessary.
>
> --
> Rick (MVP - Excel)
>
>
> "CLR" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Many thanks, Steve.........
>> Your suggestions are a lot of help....I appreciate them.
>> What I'm doing is.....I've just received a new file download from an
>> ORACLE system in .xls, but formatted to what a ORACLE person thinks is
>> good, including many variable size, or hidded, columns and rows. My
>> taks is to massage that data into a format/program that meets our needs.
>> I've done this before with straight .xls files downloaded from a
>> different computer system, so know the ropes. I can do this one too, but
>> must be sure they send me a file formatted the SAME way each month, in
>> order for my automatic macros to work more easily. So I want to
>> "profile" this one, and then be able to run that "profiler" against the
>> new file next month to see if they have changed anything besides the
>> data.
>>
>> End goal I guess is to have a macro that will insert a new Row1 and
>> ColumnA and step through and insert the RowHeights and ColumnWidths for
>> the entire used area.
>>
>> Thanks again for your help,
>> Vaya con Dios,
>> Chuck, CABGx3
>>
>>
>>
>> "AltaEgo" <Somewhere@NotHere> wrote in message
>> news:(E-Mail Removed)...
>>> Below are a set of samples that should give you a starting point. There
>>> are many variations so, try to work out what you are trying to achieve
>>> from the sample below and ask further questions if you are stuck.
>>> Generally speaking, what you can do with a row, you can do with a
>>> column. Use EntireColumn instead of EntireRow.
>>>
>>>
>>>
>>>
>>> Sub Test()
>>>
>>> If Selection.ColumnWidth = 10 Then
>>> MsgBox "Column Width exceeds 10."
>>> End If
>>> If Selection.RowHeight > 10 Then
>>> MsgBox "Row Height exceeds 10."
>>> End If
>>>
>>> 'if A2 row is hidden
>>> 'set a row height according to contents
>>> If Range("A2").EntireRow.Hidden = True Then
>>> Range("A2").EntireRow.AutoFit
>>> ' see next sub
>>> End If
>>> 'Is A2 merged
>>> MsgBox Range("A2").MergeCells
>>>
>>> End Sub
>>>
>>> Sub HideRowIfBlank()
>>>
>>> If Range("A2").Value & "" = "" Then
>>> 'hide the row
>>> Range("A2").EntireRow.RowHeight = 0
>>> Else
>>> 'unhide and size it to 25
>>> Range("A2").EntireRow.RowHeight = 25
>>> End If
>>>
>>> End Sub
>>>
>>> Sub SetA2Val()
>>> 'use to set a value in A2
>>> 'after the row is hidden
>>> Range("A2") = 1
>>> End Sub
>>>
>>> As with many problems in Excel, there are other solutions.
>>>
>>> Range("2:2").RowHeight = 12
>>>
>>> Cells(2,1).entireRow.Autofit
>>>
>>>
>>> Sub JustForFun()
>>>
>>> For i = 1 To 20
>>> Cells(i, 1).EntireRow.RowHeight = i
>>> Cells(1, i).EntireColumn.ColumnWidth = i / 6
>>> Next i
>>>
>>>
>>>
>>> --
>>> Steve
>>>
>>> "CLR" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hi All...
>>>> Is it possible to test a range of cells, for column widths and row
>>>> heights, (or maybe anything outside the default settings)?.......also
>>>> to tell if any rows or columns within that range are hidden or merged?
>>>> Any info that can be decerned would be appreciated.
>>>>
>>>> TIA
>>>> Vaya con Dios,
>>>> Chuck, CABGx3
>>>>
>>>>

>>
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Row height/column width =?Utf-8?B?Q29ubmllIE1hcnRpbg==?= Microsoft Excel Misc 3 20th Jun 2009 04:12 PM
Change Row/Column Height & Width DaveL Microsoft Excel New Users 1 19th May 2009 09:15 PM
Column Width and Row Height Workbook Microsoft Excel Worksheet Functions 4 30th Mar 2009 06:46 AM
optimising column width & row height KRK Microsoft Excel New Users 2 12th Mar 2008 12:35 PM
Column Width and Row Height =?Utf-8?B?UGlsbG93?= Microsoft Excel Worksheet Functions 0 13th Dec 2005 03:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:45 AM.