+ Reply to Thread
Results 1 to 9 of 9

VBA Worksheet Change to monitor column and then hardcode row.

  1. #1
    Registered User
    Join Date
    10-18-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2007
    Posts
    14

    Post VBA Worksheet Change to monitor column and then hardcode row.

    Hi Folks!! I have a worksheet that I have been trying to get working, but I being throw errors (for the same piece of code) and I am unsure how to resolve this.

    I keep getting a "Compile Error: Wrong number of arguments or invalid property assignment". (see code).

    Basically this is what I am wanting the worksheet change event to do:

    As information is pasted from another sheet into "A:C", the code monitors "A", IF the cell has value, then
    add code into D - I

    Then exit (if all goes well ...)

    Would one of you fine folks understand how to get this working?? I have to be able to set the range, and the Target, but the code keeps throwing me the errors.

    Thank you ...
    Humble VBA amateur


    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    Column is a propert of Target which will return the column number, not an Object.

    If you want an Object use Columns.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    10-18-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    Hi Norie!

    So, letting me make sure I am understanding correctly as I am trying hard as I can to learn the tricks of using VBA:

    If I want to use the Target.Columns, then I need to declare Cell as Range? IE:

    Please Login or Register  to view this content.

    So I make the following changes?


    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    That looks OKish.

    You don't need to declare Column and you don't need this.
    Please Login or Register  to view this content.
    This and it's End With aren't needed either.
    Please Login or Register  to view this content.
    What's happening here?

    You seeem to be using Res/result as if it's a property of Cells.

    Also Mid and Right would normallu have a string as the first argument.

    Please Login or Register  to view this content.
    Can you explain in words what the code is meant to do?

    Perhaps attach a sample workbook if you think it'll help.

  5. #5
    Registered User
    Join Date
    10-18-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    ChangeEvent_Test.xlsx

    ok ... here we go. I have done my best to explain in the workbook exactly what I am needing it to do.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    Where does the AF in I5 on 'ChangeEvent' come from?

    I can see where the rest of the value in that cell comes from but not that.

  7. #7
    Registered User
    Join Date
    10-18-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    The "AF" is just the beginning letter for the code. It does not come from anywhere. Though I have thought of adding it to the lookup table.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    So it's always 'AF' at the front of that value in column I?

  9. #9
    Registered User
    Join Date
    10-18-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Worksheet Change to monitor column and then hardcode row.

    Yes. It has to have the AF for the code to work correctly. Pain in the rump, but it is the way the coding works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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