Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Solved: Excel Macro needed to only select cells formatted as currency


(!)

slurpee55's Avatar
Computer Specs
Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
05-Aug-2010, 10:01 AM #16
Sasuke, try Application.WorksheetFunction.RoundUp
SasukeSama21's Avatar
SasukeSama21 SasukeSama21 is offline
Junior Member with 8 posts.
THREAD STARTER
 
Join Date: Aug 2010
Experience: Advanced
05-Aug-2010, 11:46 AM #17
Nope, gave me the same error!

Thanks
-SasukeSama21
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,186 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
05-Aug-2010, 01:21 PM #18
Change the code in the module as follows:

Code:

Sub CalcPercentage()
    Dim Cell1 As Range
    For Each Cell1 In Range("A1:H48")
        If IsNumeric(Cell1.Value) = True _
            And Cell1.Value <> "" Then Cell1.Value = Format(Cell1.Value * 1.02, "0.00")
    Next Cell1
End Sub
This will change all numeric cells
slurpee55's Avatar
Computer Specs
Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
05-Aug-2010, 02:15 PM #19
I figured it was because it was trying to "round" strings - is that what was happening?
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,186 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
05-Aug-2010, 03:16 PM #20
The problem is that the cells in the sample are all formatted G so when the value get's more decimals they expand
slurpee55's Avatar
Computer Specs
Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
05-Aug-2010, 03:36 PM #21
This may seem dull, but why not just format those specific cells as Number (or Currency!!!) that would be and alter the range to ignore the other cells anyway - then all you would have to deal with is blank cells....
SasukeSama21's Avatar
SasukeSama21 SasukeSama21 is offline
Junior Member with 8 posts.
THREAD STARTER
 
Join Date: Aug 2010
Experience: Advanced
05-Aug-2010, 04:01 PM #22
The problem is that throughout the entire book, there are cells with words I would have to alter the range specific to each page, and it would take far too long. However Keebellah's last code cuts the numbers to two digits so it works out. I'm going to mark this thread as solved. Thanks for all the help !

Thanks
-SasukeSama21
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
excel, if statement, letters, macro, numbers

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Title Thread Starter Forum Replies Last Post
Solved: Excel Macro Dropdown Menu Cell Contents xpertus Business Applications 36 08-Feb-2010 02:21 PM
Solved: Macro to select data "no ordered" gpiquer Business Applications 3 01-Feb-2010 12:31 PM
Excel Macro -> email created with field data as subject line MikeReich Business Applications 6 22-Jun-2009 01:39 PM
Solved: Excel macro to separate entries in a single cell mrincognito Business Applications 11 05-Jun-2009 03:14 PM
Solved: Excel macro to delete last character Paul Wit Bard Business Applications 4 31-Jul-2008 08:22 AM

WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑