pulling data and formatting

  • Thread starter Thread starter MJHackman
  • Start date Start date
M

MJHackman

I was wondering if there is any way to pull both the data and the
formatting when using an if function? Assuming there is not, any help
me with the VBA code to do such? Thanks.
 
I was wondering if there is any way to pull both the data and the
formatting when using an if function? Assuming there is not, any help
me with the VBA code to do such? Thanks.

Depending on what you want to do:

===============================
Option Explicit
Sub PrnFmt()
Dim c As Range
For Each c In Selection
Debug.Print c.Text
Next c

For Each c In Selection
With c.Offset(0, 1)
.NumberFormat = c.NumberFormat
.Value = c.Value
End With
Next c
End Sub
===============================

--ron
 

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

Back
Top