Runtime Error 13 - Type Mismatch

geraldlee

New Member
Joined
Dec 7, 2016
Messages
2
Hi All,

I have been give a speadsheet that has a date column which should increment by either by 2, 5, 7, 14, 28 or 56 days. These are chosen by selecting 1 of 6 buttons.

Each time I press a but to increment the date I receive the following error message:

Sub Increase_date_by_days_on_button_1()


Dim r As String
r = ActiveCell.Row
Dim h As String
h = "K" & r


Range(h).Value = Range(h).Value + Worksheets("Settings").Range("c5").Value


End Sub

Any advice on resolving this would be hugely appreciated.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,945
Office Version
  1. 365
Platform
  1. Windows
Hi, that error would suggest that you don't have a valid number in C5 of the settings sheet or a valid date in column K for the active cells row.
 
Upvote 0

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,886
Office Version
  1. 365
Platform
  1. Windows
As an aside id be extremely careful using activecell in this macro. You could end up changing the wrong cell in column K.
 
Upvote 0

geraldlee

New Member
Joined
Dec 7, 2016
Messages
2
Hi All,

Yep, Column K was the issue. Change to the current date column and hey, it worked.

Great stuff. My Programme Manager thinks I'm a star.


Cheers
 
Upvote 0

Forum statistics

Threads
1,195,671
Messages
6,011,077
Members
441,581
Latest member
rp4717

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top