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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

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
 
Status
Not open for further replies.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,091
Messages
5,768,039
Members
425,451
Latest member
JohnBrooksBiddle

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