Why does this not work?

Status
Not open for further replies.

Adrian1

Board Regular
Joined
Dec 30, 2003
Messages
126
I have a command button with the following code:

Private Sub CommandButton5_Click()

Range("index2").Value = Range("index1").Value + 1

End Sub

I would assume that this would make index2 the same value as index1+1. But for some reason, when I click on the button it gives me a 'Runtime 13' error (Type Mismatch). This has been doing my head in all day! Can someone help me please? o_O
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

clares

Well-known Member
Joined
Mar 14, 2002
Messages
557
Hi There

Is index1 and index2 a named range? Do you have text value in them at all?

Kind Regards

Peter
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,187,172
Messages
5,962,031
Members
438,576
Latest member
Cstewart29

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