LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tb tb is offline
external usenet poster
 
Posts: 84
Default Excel Macro: Type mismatch (Error 13)

I am using Microsoft Excel 2010.

Several years ago, Claus Busch wrote the following macro for me:

Sub roundSelection()
Dim pctChange As Double
Dim Cell As Range
pctChange = Range("pctChange")
For Each Cell In Selection
Cell = WorksheetFunction.Round(Cell * (1 + pctChange), 2)
Next Cell
End Sub

When I try to run it now, I get "Run-time error '13': Type mismatch".
The problem seems to be this line of code:

Cell = WorksheetFunction.Round(Cell * (1 + pctChange), 2)

....but I don't know how to fix it as I am no expert with macros!

The macro should work like this: If one of the worksheet tabs has a
box named "pctChange" and a % value underneath that box, it should
apply the % value to all the worksheet boxes in that tab that are
formatted as currency (i.e. $ - U.S. Dollars in my case).

I should be able to specify a different "pctChange" value for each
worksheet tab and then run the macro.

Can anybody please help? I'm willing to post the spreadsheet
somewhere, if that helps.

Thanks.
--
tb
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error 13 - type mismatch error in Excel 97 on Citrix Kevin Maher Excel Programming 7 March 8th 08 11:48 AM
Error type mismatch in writing macro ub Excel Worksheet Functions 2 September 26th 07 12:48 PM
Macro error type mismatch Jurassien Excel Discussion (Misc queries) 3 February 23rd 07 08:14 PM
type mismatch error in Benford's law macro Sody Excel Programming 1 May 24th 06 11:07 PM
Visual Basic macro run time error(13) type mismatch Paul Excel Discussion (Misc queries) 0 October 25th 05 07:28 AM


All times are GMT +1. The time now is 06:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"