ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do i get a column format to follow me from one cell to another (https://www.excelbanter.com/excel-programming/426418-how-do-i-get-column-format-follow-me-one-cell-another.html)

Graphically Challenged[_2_]

how do i get a column format to follow me from one cell to another
 
As I go through my spreadsheet I am calculating "max" and "min" values. When
I decide a column to work in I want to calculate the value and then format
the column to a 4-point decimal value "0.0000". I don't know in advance
which column I need to work in, but when I find one I want to perform those
two operations. I'm trying to set up a macro that is will be achored to the
current column I am working in. How can I do that?

Thanks!


Rick Rothstein

how do i get a column format to follow me from one cell to another
 
Give this code a try...

Sub Test()
With ActiveCell.EntireColumn
Min = WorksheetFunction.Min(.Cells)
Max = WorksheetFunction.Max(.Cells)
.NumberFormat = "0.0000"
End With

' You didn't say what you wanted to do
' with Min, Max, so I just show them
MsgBox Min & " // " & Max
End Sub

Just activate any cell in the column and then run the code.

--
Rick (MVP - Excel)


"Graphically Challenged"
wrote in message ...
As I go through my spreadsheet I am calculating "max" and "min" values.
When
I decide a column to work in I want to calculate the value and then format
the column to a 4-point decimal value "0.0000". I don't know in advance
which column I need to work in, but when I find one I want to perform
those
two operations. I'm trying to set up a macro that is will be achored to
the
current column I am working in. How can I do that?

Thanks!




All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com