Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Column width and Row height test?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Column width and Row height test?

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" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Column width and Row height test?

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
...
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" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Column width and Row height test?

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" wrote in message
...
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
...
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" wrote in message
...
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





  #5   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Column width and Row height test?

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" wrote in message
...
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" wrote in message
...
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
...
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" wrote in message
...
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
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/column width Connie Martin Excel Discussion (Misc queries) 3 June 20th 09 04:12 PM
Column Width and Row Height Workbook Excel Worksheet Functions 4 March 30th 09 06:46 AM
column width and row height formatting, & IF SteveDB1 Excel Programming 3 June 5th 08 11:36 PM
Column Width and Row Height Pillow Excel Worksheet Functions 0 December 13th 05 03:58 PM
Displaying column width and row height swirlygirl Excel Worksheet Functions 3 February 7th 05 09:53 PM


All times are GMT +1. The time now is 11:18 AM.

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

About Us

"It's about Microsoft Excel"