+ Reply to Thread
Results 1 to 4 of 4

How to return values into a spreadsheet without changing the value in the previous cell.

  1. #1
    Registered User
    Join Date
    10-21-2016
    Location
    new york
    MS-Off Ver
    2012
    Posts
    5

    How to return values into a spreadsheet without changing the value in the previous cell.

    I'm doing a simulation in vba between two players playing badminton.
    I've pretty much done all the coding to represent a game, set etc. however i wanted to record all the scores for each game on a spreadsheet in excel, however as i do not know how many games they are going to play in total i'm struggling to do this.

    Firstly I have done ..

    If points1 = 4 Or points2 = 4 Then
    GamesPlayed = GamesPlayed + 1
    For j = 1 To GamesPlayed
    Worksheets("RESULTS").Cells(j + 9, 1).Value = GamesPlayed
    Next j
    End If

    But this changes the previous value in the previous cell, when i want it to stay the same.

    Any help would be appreciated!

  2. #2
    Registered User
    Join Date
    10-21-2016
    Location
    new york
    MS-Off Ver
    2012
    Posts
    5

    Re: How to return values into a spreadsheet without changing the value in the previous cel

    I know it is to do with...

    For j = 1 to GamesPlayed

    But im not quite sure what else to put if i dont know the total games that they are going to play.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How to return values into a spreadsheet without changing the value in the previous cel

    seeing more of the code or even the spreadsheet would help a lot.. but if it helps, this line would assign lr the last row with data in column A, maybe then you could use cells(lr+1,1) to paste into the next available row?

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Registered User
    Join Date
    10-21-2016
    Location
    new york
    MS-Off Ver
    2012
    Posts
    5

    Re: How to return values into a spreadsheet without changing the value in the previous cel

    SETS GAMES POINTS
    A 3 0
    B 6 0



    SET 1
    GAMES PLAYER A PLAYER B



    so I have my score board at the top of the spreadsheet, but then underneath i wanted it to tell me what game was being played and then the score for each player..

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 02-23-2015, 12:28 AM
  2. Auto-move previous content from cell a to cell b by changing cell a
    By Matt81a in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2013, 03:32 PM
  3. fill next blank cell from one cell w/o changing previous cells
    By doodle72 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-07-2013, 12:35 PM
  4. Changing date to next day based on previous cell
    By Willmannyeatthat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2012, 10:17 AM
  5. Replies: 1
    Last Post: 12-05-2011, 12:58 PM
  6. Excel 2007 : Search and Return Previous Non Zero Values
    By samtoucan in forum Excel General
    Replies: 3
    Last Post: 12-10-2009, 09:12 PM
  7. Return to a previous cell
    By Ken G. in forum Excel General
    Replies: 2
    Last Post: 10-19-2005, 03:05 PM

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