Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / August 2007

Tip: Looking for answers? Try searching our database.

pulling data and formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MJHackman@gmail.com - 22 Aug 2007 16:49 GMT
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.
Ron Rosenfeld - 22 Aug 2007 17:03 GMT
>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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.