Results 1 to 4 of 4

Error 2023 - triggered by variable - Cant find mistake

Threaded View

  1. #1
    Registered User
    Join Date
    08-19-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    50

    Error 2023 - triggered by variable - Cant find mistake

    Hello!
    Starting Point: I have a master sheet, where I can activate a new sheet with a checkbox that gets the name of a certain cell. Afterwards I want to switch back to the master sheet and insert some formulas containing the name of the new sheet. The problem is I get a 2023 error for the variables that I marked red in the following code. I know it is a reference error but I dont know how to fix it. I just want the macro to insert the formula instead of checking reference. The code that the variable produces is correct (I tested it) and does what I want it to do, but the macro does not insert it:

    Sub Diätplaner_Tagestyp_niedrig()
    Dim VorgesehenAls As String
    Dim EK As String
    Dim KALORIEN As String
    Dim Carbs As String
    Dim Makroverhältnis As String
    Dim Shtname As String
    Shtname = Range("I73").Value
    VorgesehenAls = "=IF(" & Shtname & "!E54=TRUE; ""TT"" ;""NTT"")"
    EK = "=IF(" & Shtname & "!E54=TRUE;""TT"";""NTT"")"
    KALORIEN = "=" & Shtname & "!49"
    Carbs = "=" & Shtname & "!G49"
    Makroverhältnis = "=TEXT(" & Shtname & "!F51*100;""0"")" & " / " & "TEXT(" & Shtname & "!G51*100;""0"")" & " / " & "TEXT(" & Shtname & "!H51*100;""0"")"
        If Sheets("Diätplaner").Range("I72").Value = True Then
            If WorksheetExistsNiedrig = False Then
                Sheets("Diätplaner").Copy After:=ActiveSheet
                ActiveSheet.Name = Shtname
                Sheets("Diätplaner").Select
                'Formeln einsetzen, die oben festgelegt wurden
                Range("I75").Value = EK
                Range("I76").Value = KALORIEN
                Range("I78").Value = Makroverhältnis
                Range("I79").Value = Carbs
                Range("I74").Value = VorgesehenAls
            Else
                Exit Sub
            End If
        Else
            [...]
        End If
    End Sub
    Thanks a lot,
    Taktiker
    Last edited by Taktiker; 10-22-2012 at 09:09 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1