Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error 13 - type mismatch error in Excel 97 on Citrix | Excel Programming | |||
Error type mismatch in writing macro | Excel Worksheet Functions | |||
Macro error type mismatch | Excel Discussion (Misc queries) | |||
type mismatch error in Benford's law macro | Excel Programming | |||
Visual Basic macro run time error(13) type mismatch | Excel Discussion (Misc queries) |