+ Reply to Thread
Results 1 to 10 of 10

Need Help with Macro Code

  1. #1

    Need Help with Macro Code

    Hello!
    I need some help with a macro code for excel. I'm a beginner who
    doesn't know quite how to do begin. I have records in rows in an Excel
    spread sheet, I need code that would check each record to see if data
    is present in column AB cell. If AB is NOT blank, I need it to check if
    column AA cell is blank. If it AA is blank, I need it to copy the data
    from column B cell to column AA cell...again only if column AB is not
    blank and AA is blank (if AB is blank, it shouldn't do anything). Hope
    that made sense. Thanks in advance for all your help.


  2. #2
    Bob Phillips
    Guest

    Re: Need Help with Macro Code


    For i = 1 To Cells(Rows.Count,"AB").End(xlUp).Row
    If Cells(i,"AB").Value <> "" Then
    If Cells(i,"AA").Value = "" Then
    Cells(i,"AA"),value = Cells(i,"B").Value
    End If
    End If
    Next i

    --
    HTH

    Bob Phillips

    <[email protected]> wrote in message
    news:[email protected]...
    > Hello!
    > I need some help with a macro code for excel. I'm a beginner who
    > doesn't know quite how to do begin. I have records in rows in an Excel
    > spread sheet, I need code that would check each record to see if data
    > is present in column AB cell. If AB is NOT blank, I need it to check if
    > column AA cell is blank. If it AA is blank, I need it to copy the data
    > from column B cell to column AA cell...again only if column AB is not
    > blank and AA is blank (if AB is blank, it shouldn't do anything). Hope
    > that made sense. Thanks in advance for all your help.
    >




  3. #3

    Re: Need Help with Macro Code

    Hello, Bob! Thanks for the help. I tried your code but got the
    following error
    Compile error: syntax error on the Cells(i,"AA"),value =
    Cells(i,"B").Value line
    Any ideas on how to fix? Thanks!


  4. #4
    Dave Peterson
    Guest

    Re: Need Help with Macro Code

    It was a typo:

    Cells(i,"AA"),value
    should have been:

    Cells(i,"AA").Value



    [email protected] wrote:
    >
    > Hello, Bob! Thanks for the help. I tried your code but got the
    > following error
    > Compile error: syntax error on the Cells(i,"AA"),value =
    > Cells(i,"B").Value line
    > Any ideas on how to fix? Thanks!


    --

    Dave Peterson

  5. #5

    Re: Need Help with Macro Code

    I tried fixing the typo but I'm getting the same error on the same
    line. Any ideas? thanks!

    Dave Peterson wrote:
    > It was a typo:
    >
    > Cells(i,"AA"),value
    > should have been:
    >
    > Cells(i,"AA").Value
    >
    >
    >
    > [email protected] wrote:
    > >
    > > Hello, Bob! Thanks for the help. I tried your code but got the
    > > following error
    > > Compile error: syntax error on the Cells(i,"AA"),value =
    > > Cells(i,"B").Value line
    > > Any ideas on how to fix? Thanks!

    >
    > --
    >
    > Dave Peterson



  6. #6
    Bob Phillips
    Guest

    Re: Need Help with Macro Code

    Juts tested it with the typo fixed, works as I read the requiremnet.

    --
    HTH

    Bob Phillips

    <[email protected]> wrote in message
    news:[email protected]...
    > I tried fixing the typo but I'm getting the same error on the same
    > line. Any ideas? thanks!
    >
    > Dave Peterson wrote:
    > > It was a typo:
    > >
    > > Cells(i,"AA"),value
    > > should have been:
    > >
    > > Cells(i,"AA").Value
    > >
    > >
    > >
    > > [email protected] wrote:
    > > >
    > > > Hello, Bob! Thanks for the help. I tried your code but got the
    > > > following error
    > > > Compile error: syntax error on the Cells(i,"AA"),value =
    > > > Cells(i,"B").Value line
    > > > Any ideas on how to fix? Thanks!

    > >
    > > --
    > >
    > > Dave Peterson

    >




  7. #7
    Dave Peterson
    Guest

    Re: Need Help with Macro Code

    You're getting a compile error?

    You may want to post the current state of your macro.

    [email protected] wrote:
    >
    > I tried fixing the typo but I'm getting the same error on the same
    > line. Any ideas? thanks!
    >
    > Dave Peterson wrote:
    > > It was a typo:
    > >
    > > Cells(i,"AA"),value
    > > should have been:
    > >
    > > Cells(i,"AA").Value
    > >
    > >
    > >
    > > [email protected] wrote:
    > > >
    > > > Hello, Bob! Thanks for the help. I tried your code but got the
    > > > following error
    > > > Compile error: syntax error on the Cells(i,"AA"),value =
    > > > Cells(i,"B").Value line
    > > > Any ideas on how to fix? Thanks!

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  8. #8

    Re: Need Help with Macro Code

    My mistake. It does work! I had a typo some where else on the line.
    Sorry about that. THANKS for your help!!!


  9. #9

    Re: Need Help with Macro Code

    My mistake. It does work! I had a typo some where else on the line.
    Sorry about that. THANKS for your help!!!


  10. #10

    Re: Need Help with Macro Code

    My mistake. It does work! I had a typo some where else on the line.
    Sorry about that. THANKS for your help!!!


+ 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