Consulting

Results 1 to 8 of 8

Thread: Sleeper: Real N00B help about free cells

  1. #1
    VBAX Regular
    Joined
    Mar 2005
    Posts
    31
    Location

    Sleeper: Real N00B help about free cells

    Hello everybody, I'm pretty new with the VBA things and I'm trying o do something special. I'll try to explain.

    I'm doing a calculation and when a button is pressed I want to save that number in Sheet2. But the previous savings also have to be saved.
    So I have done a calculation, I press a button to save it in A1 on Sheet 2.
    I'm doing a new calculation and I press again the button to save it. But I don't want the number in A1 to be lost, so I want that the macro automatically searchs for the next free cell.
    How can I do this?
    Do I also have to include the fact that only the number and not the formula has to be saved?

    Thanks
    IVY440

  2. #2
    Knowledge Base Approver
    Space Cadet
    VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    would you like to move across, column to column or down, row by row?
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  3. #3
    VBAX Regular
    Joined
    Mar 2005
    Posts
    31
    Location
    Sorry I don't get or don't you want to help me?

  4. #4
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    My apologies for not saying it earlier - Welcome to VBAX

    And yes I would like to help you, I just need some more information about your problem. I would like to know If you want to place the "new" answer when you redo your calculation into the column next to old one (same row different cell Eg 1st answer in A1, next answer in B1) or into the row below (same column, different row Eg 1st Answer A1, next answer A2 etc) on sheet two? Because there are two ways of looking for the next empty cell, either by column or by row.


    Dim LastColumn As Integer
    LastColumn = Range("A1").Column.End(xlRight)
    Range("A"&(LastColumn+1)).Value = NewAnswer
    Or

    Dim
     LastRow As Integer
    LastRow = Range("A65536").Row.End(xlUp)
    Range("A"&(LastRow+1)).Value = NewAnswer
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  5. #5
    VBAX Regular
    Joined
    Mar 2005
    Posts
    31
    Location
    Sorry sandam, my mistake, I didn't see the post, only the very big signature.
    Sorry for that
    It has to be the next row. I'll try to check if it's possible in your way (not that I doubt about the real VBA'ers

    Euhm, when I compile it, it gives an error on this line
    LastRow = Range("A65536").Row.End(xlUp)
    with the notification for .Row: Invalid Qualifier

    What to do?

  6. #6
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    My mistake

    the line should be -

    LastRow = Range("A65536").End(xlUp).Row
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  7. #7
    VBAX Regular
    Joined
    Mar 2005
    Posts
    31
    Location
    How can I make the NewAnswer a special paste?
    Can I just put:
    Range("A"&(LastRow+1)).Value = PasteSpecial(Value)
    Or how do I have to encode it?

  8. #8
    VBAX Regular
    Joined
    Mar 2005
    Posts
    31
    Location
    I still have problems with this thread.
    When I run the macro, he puts the value in Sheet1 and I want it in Sheet2.
    Also he doesn't take the first free cell in Sheet2.

    Please help

    This doesn't work
    He gives the error that the merged cells has to have the same size. Error on line 6

    Dim LastRow As Integer
    Range("B15").Select
    Selection.Copy
    ActiveSheet.Next.Select
    LastRow = Range("A65536").End(xlUp).Row
    Range("A" & (LastRow + 1)).PasteSpecial (xlPasteValues)
    Sheets("Sheet1").Select

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •