how do i get a column format to follow me from one cell to another

  • Thread starter Graphically Challenged
  • Start date
G

Graphically Challenged

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!
 
R

Rick Rothstein

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top