+ Reply to Thread
Results 1 to 6 of 6

Help with code

  1. #1
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215

    Help with code

    The following code is returning a Compile Error: Automation type not supported in visual basic. The underlined portion of the code is what is highlighted when I get the error message.

    Regards,

    EP

    Sub Button9_Click()

    Dim Answer As VbMsgBoxResult
    Dim blnCopy As Boolean
    If Sheets("Data").Range("Y3").Value = Sheets("Input").Range("G9").Value Then
    CopyData:
    ********Sheets("Input").Range("G15:H29").Copy
    ********Sheets("Data").Range("D114").PasteSpecial Paste:=xlValues, SkipBlanks:=True
    ********Sheets("Input").Range("G15:H29").ClearContents
    ********Sheets("Input").Range("L15:M24").Copy
    ********Sheets("Data").Range("D130").PasteSpecial Paste:=xlValues
    ********Sheets("Input").Range("L15:M24").ClearContents
    If blnCopy = True Then GoTo ResumeHere
    **blnCopy = True
    End If
    If Range("C15").Value <> Range("F15").Value = False Then
    ********Answer = MsgBox("These dates have already been entered. Do you want to continue?", vbYesNo)
    End If
    If Answer = vbYes Then
    *GoTo CopyData
    ResumeHere:
    ElseIf Answer = vbNo Then
    ** 'Do Nothing
    End If
    Continue:
    ****Application.CutCopyMode = False
    End Sub

  2. #2
    Bob Phillips
    Guest

    Re: Help with code

    Just declare it as Long.

    edwardpestian wrote:
    > The following code is returning a Compile Error: Automation type not
    > supported in visual basic. The underlined portion of the code is what
    > is highlighted when I get the error message.
    >
    > Regards,
    >
    > EP
    >
    > Sub Button9_Click()
    >
    > Dim _Answer_As_VbMsgBoxResult_
    > Dim blnCopy As Boolean
    > If Sheets("Data").Range("Y3").Value =
    > Sheets("Input").Range("G9").Value Then
    > CopyData:
    > ********Sheets("Input").Range("G15:H29").Copy
    > ********Sheets("Data").Range("D114").PasteSpecial Paste:=xlValues,
    > SkipBlanks:=True
    > ********Sheets("Input").Range("G15:H29").ClearContents
    > ********Sheets("Input").Range("L15:M24").Copy
    > ********Sheets("Data").Range("D130").PasteSpecial Paste:=xlValues
    > ********Sheets("Input").Range("L15:M24").ClearContents
    > If blnCopy = True Then GoTo ResumeHere
    > **blnCopy = True
    > End If
    > If Range("C15").Value <> Range("F15").Value = False Then
    > ********Answer = MsgBox("These dates have already been entered. Do you
    > want to continue?", vbYesNo)
    > End If
    > If Answer = vbYes Then
    > *GoTo CopyData
    > ResumeHere:
    > ElseIf Answer = vbNo Then
    > ** 'Do Nothing
    > End If
    > Continue:
    > ****Application.CutCopyMode = False
    > End Sub
    >
    >



  3. #3
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215

    Not sure how

    I'm new to VBA, so this is a learing experience for me. Can you tell me how to declare it as long.

    Regards,

    EP

  4. #4
    Dave Peterson
    Guest

    Re: Help with code

    Dim Answer As Long



    edwardpestian wrote:
    >
    > I'm new to VBA, so this is a learing experience for me. Can you tell me
    > how to declare it as long.
    >
    > Regards,
    >
    > EP
    >
    > --
    > edwardpestian
    > ------------------------------------------------------------------------
    > edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
    > View this thread: http://www.excelforum.com/showthread...hreadid=537485


    --

    Dave Peterson

  5. #5
    Two-Canucks
    Guest

    RE: Help with code

    Sorry to break the rule of not asking a question here;
    but how do I start a new thread?
    Clicked on New, then ? new question, then nothing happened.
    Could not type in the box. Notihing in Help.
    --
    Occasionally stumped


    "edwardpestian" wrote:

    >
    > The following code is returning a Compile Error: Automation type not
    > supported in visual basic. The underlined portion of the code is what
    > is highlighted when I get the error message.
    >
    > Regards,
    >
    > EP
    >
    > Sub Button9_Click()
    >
    > Dim _Answer_As_VbMsgBoxResult_
    > Dim blnCopy As Boolean
    > If Sheets("Data").Range("Y3").Value =
    > Sheets("Input").Range("G9").Value Then
    > CopyData:
    > ********Sheets("Input").Range("G15:H29").Copy
    > ********Sheets("Data").Range("D114").PasteSpecial Paste:=xlValues,
    > SkipBlanks:=True
    > ********Sheets("Input").Range("G15:H29").ClearContents
    > ********Sheets("Input").Range("L15:M24").Copy
    > ********Sheets("Data").Range("D130").PasteSpecial Paste:=xlValues
    > ********Sheets("Input").Range("L15:M24").ClearContents
    > If blnCopy = True Then GoTo ResumeHere
    > **blnCopy = True
    > End If
    > If Range("C15").Value <> Range("F15").Value = False Then
    > ********Answer = MsgBox("These dates have already been entered. Do you
    > want to continue?", vbYesNo)
    > End If
    > If Answer = vbYes Then
    > *GoTo CopyData
    > ResumeHere:
    > ElseIf Answer = vbNo Then
    > ** 'Do Nothing
    > End If
    > Continue:
    > ****Application.CutCopyMode = False
    > End Sub
    >
    >
    > --
    > edwardpestian
    > ------------------------------------------------------------------------
    > edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
    > View this thread: http://www.excelforum.com/showthread...hreadid=537485
    >
    >


  6. #6
    Dave Peterson
    Guest

    Re: Help with code

    You're posting through the Microsoft Communities web site, right?

    There's a New button/icon to the left of the "Show" (all threads, etc) that you
    can click on.



    Two-Canucks wrote:
    >
    > Sorry to break the rule of not asking a question here;
    > but how do I start a new thread?
    > Clicked on New, then ? new question, then nothing happened.
    > Could not type in the box. Notihing in Help.
    > --
    > Occasionally stumped
    >
    > "edwardpestian" wrote:
    >
    > >
    > > The following code is returning a Compile Error: Automation type not
    > > supported in visual basic. The underlined portion of the code is what
    > > is highlighted when I get the error message.
    > >
    > > Regards,
    > >
    > > EP
    > >
    > > Sub Button9_Click()
    > >
    > > Dim _Answer_As_VbMsgBoxResult_
    > > Dim blnCopy As Boolean
    > > If Sheets("Data").Range("Y3").Value =
    > > Sheets("Input").Range("G9").Value Then
    > > CopyData:
    > > ********Sheets("Input").Range("G15:H29").Copy
    > > ********Sheets("Data").Range("D114").PasteSpecial Paste:=xlValues,
    > > SkipBlanks:=True
    > > ********Sheets("Input").Range("G15:H29").ClearContents
    > > ********Sheets("Input").Range("L15:M24").Copy
    > > ********Sheets("Data").Range("D130").PasteSpecial Paste:=xlValues
    > > ********Sheets("Input").Range("L15:M24").ClearContents
    > > If blnCopy = True Then GoTo ResumeHere
    > > **blnCopy = True
    > > End If
    > > If Range("C15").Value <> Range("F15").Value = False Then
    > > ********Answer = MsgBox("These dates have already been entered. Do you
    > > want to continue?", vbYesNo)
    > > End If
    > > If Answer = vbYes Then
    > > *GoTo CopyData
    > > ResumeHere:
    > > ElseIf Answer = vbNo Then
    > > ** 'Do Nothing
    > > End If
    > > Continue:
    > > ****Application.CutCopyMode = False
    > > End Sub
    > >
    > >
    > > --
    > > edwardpestian
    > > ------------------------------------------------------------------------
    > > edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
    > > View this thread: http://www.excelforum.com/showthread...hreadid=537485
    > >
    > >


    --

    Dave Peterson

+ Reply to Thread

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