Run-time Error '13'

santi 1 Reputation point
2021-11-22T15:15:58.483+00:00

Hi guys,

Could you help me with this error ? I'm a bit lost ..

Thx a lot,
Santi


Sub Actualisatie()

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = False
Dim i As Integer
i = 0

'STEP 1. CALCULATE OT FOR EACH PROJECT PERIOD

    Range("Scenario").Value = i


    Do While i <= Range("subs_period").Value

        Application.StatusBar = "Actualisation (VEA-Model): Goalseek OT in year " & i

        Range("Scenario").Value = i
        Call Goalseek
        Range("OT_Start").Offset(0, i).Value = Range("GS_OT_PF_GS").Value
        i = i + 1

        Application.StatusBar = False

 Loop

'STEP 2. RETURN TO START PERIOD

 'Range("SCenario").Value = 0
    'Call Goalseek

End Sub

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,780 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 56,951 Reputation points
    2021-11-22T16:17:45.97+00:00

    Given just VB and runtime error 13 it looks like a type issue but it isn't clear. Could you provide some more information as it is really hard to just look at your code and figure things out?

    1. What line is generating the runtime error?
    2. This looks like an Excel spreadsheet code, are you calling this from within an Excel macro or via an app that is talking to Excel using interop?
    3. Can you provide a sample set of data in your spreadsheet including the column information so we can try to replicate the issue?

    Just on a guess I'm going to assume the range you're passing to this code is bad. Especially around that Scenario column. But this is a total guess at this point.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.