+ Reply to Thread
Results 1 to 13 of 13

problems with replicating VBA code (every other line)

  1. #1
    Registered User
    Join Date
    03-16-2011
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    problems with replicating VBA code (every other line)

    ok, so i'm working on a balance sheet type of spreadhseet.

    i have figured out how to get the results that i want by using a macro, yet am failing at having it replicated on every other (odd) row.

    i had thought about just repeating the macro by changing the row number in each instance as there's only 15 lines that i would need to do this for, but that's not working either AND i also thought there would be an easier way to accomplish this.

    i am open to any suggestions that you all might have. essentially, the code allows the cell to perform a basic math function unless an alpha designator is placed in a different cell, which in turn, clears its contents and allows the user to manually input the amount.

    the code is as follows:

    Please Login or Register  to view this content.
    Last edited by redbroyer; 03-16-2011 at 11:50 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: problems with replicating VBA code (every other line)

    Hi redbroyer
    Welcome to the forum.
    It hard to know exactly but maybe..
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    03-16-2011
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: problems with replicating VBA code (every other line)

    thank you for the welcome.

    i tried what you suggested and it still did not work.

    this is what i'm working on.

    in the first row, i have a balance carry over from the previous sheet. the second row is an example of the "in" statement which means that the cell under the inventory column is cleared out so that the user and manually input a number. (in this case it's an expense)

    the third row is an example of how it should look if the "in", "sa", "pc", or "bi" are not put into the reason column. when these do not show up in the reason column, i want the spreadsheet to look to the cell in the c column and perform the mathematical operations upon that total. (50%, 5%, 5%, and 40%)

    i need the reason to also be able to accept text input that describes the transaction if it is not "in", "sa", "pc", or "bi". (such as sold a stereo to Bill)

    the formula that i have works but i cannot get it to replicate in the other yellow shaded rows. obviously the white rows are balance trackers while the yellow shaded rows would be the transaction rows. if i could get my current formula to be applied to rows 9, 11, 13, 15, 17, etc i would be thrilled. i have been unable to do that as of yet though.

    i'm hoping that was a better explanation. i'm sorry that i didn't include that to begin with. i have been staring at this thing for so long that i'm boggled. lol

    thank you again for the attempt and i appreciate you looking at this.

    i have attached a screen shot so that you can get a better idea of what it looks like.
    Attached Images Attached Images

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: problems with replicating VBA code (every other line)

    looks good but not helpful in excel forum - upload a workbook

  5. #5
    Registered User
    Join Date
    03-16-2011
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: problems with replicating VBA code (every other line)

    Quote Originally Posted by pike View Post
    looks good but not helpful in excel forum - upload a workbook
    ok, here's the workbook. it's actually in 97-2003 format.
    Attached Files Attached Files

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: problems with replicating VBA code (every other line)

    Hi redbroyer

    I think you enter data in columns b or c?
    explination is unclear but try

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-16-2011
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: problems with replicating VBA code (every other line)

    data is being entered in both columns b & c depending on the type of transaction.

    for instance. if the data is for a sale, then in column "b" the item sold might be input and in column "c" the amount of the sale would be input.

    however, if in column "b" there is "in", "sa", "bi", or "pc", then that means that there is a business expense and there would be nothing entered into column "c".

    in my example, the first entry (b9) is for an expense towards inventory, or "in". this allows cell e9 to be cleared of its contents and allows the user to manually input the amount of the expense.

    in the second entry (b11 & c11) a sale is made for $100 and a description of the merchandise would be entered into b11 while the sale price would be entered into c11. once this is done, columns d, e, f, g, & h all use calculations to determine the amount of each sale that is split into different parts. then the balance is carried over to the next row and keeps a running tally of each column.

    i tried the formula, but it seems to not want to work.

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: problems with replicating VBA code (every other line)

    It does work just run but i dont think as you want
    so you can have entry in both b & c column in the same row?
    Please Login or Register  to view this content.
    just in case the events errored and were disabled

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: problems with replicating VBA code (every other line)

    i think ive go it
    But this only triggers after entry in column c
    Please Login or Register  to view this content.

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: problems with replicating VBA code (every other line)

    redbroyer
    you will need to change the last events to true
    but it better to remove both as they are not needed in the example
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: problems with replicating VBA code (every other line)

    or
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-16-2011
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: problems with replicating VBA code (every other line)

    i just wanted to let you know everything works perfectly.

    i'm having some issues getting another calculation to work, but it's probably just me.

    thank you for working on this and providing a solution!

    sorry i didn't post this earlier!

  13. #13
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: problems with replicating VBA code (every other line)

    or ?
    Please Login or Register  to view this content.
    Last edited by snb; 03-23-2011 at 10:17 AM.



+ 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