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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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
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
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,214,813
Messages
6,121,706
Members
449,048
Latest member
81jamesacct

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
Back
Top