Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have two different workbooks, a test book and a results book. I would like
to have a command button, that when clicked, opens the results workbook and fill the users name and answers in the appropriate columns, say A1 through G1. Then it saves the results workbook, closes it, and clears the contents of the cells in the test workbook that contains the answers the user selected. Then when someone else takes the test and does the same thing, their answers are saved BELOW the first person in the results workbook, allowing me to use the same test workbook and log everyone's results n the same workbook. I know how to call open a new workbook, save and close it, and clear the contents, but what I don't know is how to get the second or third or fourth users answers to be entered in the row below the person before them. Hope this makes sense and someone can help. Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code fragment will give you the last row used, in Col A, on
Data Sheet in the variable LastRow... Add 1 to it and write to that row... Dim LastRow As Long With Worksheets("Data") LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row End With MsgBox LastRow "GLHEC-BLS" wrote: I have two different workbooks, a test book and a results book. I would like to have a command button, that when clicked, opens the results workbook and fill the users name and answers in the appropriate columns, say A1 through G1. Then it saves the results workbook, closes it, and clears the contents of the cells in the test workbook that contains the answers the user selected. Then when someone else takes the test and does the same thing, their answers are saved BELOW the first person in the results workbook, allowing me to use the same test workbook and log everyone's results n the same workbook. I know how to call open a new workbook, save and close it, and clear the contents, but what I don't know is how to get the second or third or fourth users answers to be entered in the row below the person before them. Hope this makes sense and someone can help. Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That works great, but I don't understand the last part about adding 1. I
understand this is supose to tak eit to the row below the one with the last entry, but I'm not sure where you mean to add the + 1 to the variable LastRow. This is what I have right now. Private Sub Worksheet_Activate() Dim LastRow As Long With Worksheets("Learning Style") LastRow = .Cells(.Rows.Count, "B").End(xlUp).Select End With End Sub "Sheeloo" wrote: The following code fragment will give you the last row used, in Col A, on Data Sheet in the variable LastRow... Add 1 to it and write to that row... Dim LastRow As Long With Worksheets("Data") LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row End With MsgBox LastRow "GLHEC-BLS" wrote: I have two different workbooks, a test book and a results book. I would like to have a command button, that when clicked, opens the results workbook and fill the users name and answers in the appropriate columns, say A1 through G1. Then it saves the results workbook, closes it, and clears the contents of the cells in the test workbook that contains the answers the user selected. Then when someone else takes the test and does the same thing, their answers are saved BELOW the first person in the results workbook, allowing me to use the same test workbook and log everyone's results n the same workbook. I know how to call open a new workbook, save and close it, and clear the contents, but what I don't know is how to get the second or third or fourth users answers to be entered in the row below the person before them. Hope this makes sense and someone can help. Thanks! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
do it this way:
LastRow = .Cells(.Rows.Count, "B").End(xlUp) + 1 LastRow.Select :) susan On Nov 12, 1:06*pm, GLHEC-BLS wrote: That works great, but I don't understand the last part about adding 1. I understand this is supose to tak eit to the row below the one with the last entry, but I'm not sure where you mean to add the + 1 to the variable LastRow. This is what I have right now. Private Sub Worksheet_Activate() Dim LastRow As Long With Worksheets("Learning Style") LastRow = .Cells(.Rows.Count, "B").End(xlUp).Select End With End Sub "Sheeloo" wrote: The following code fragment will give you the last row used, in Col A, on Data Sheet in the variable LastRow... Add 1 to it and write to that row... Dim LastRow As Long With Worksheets("Data") LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row End With MsgBox LastRow "GLHEC-BLS" wrote: I have two different workbooks, a test book and a results book. I would like to have a command button, that when clicked, opens the results workbook and fill the users name and answers in the appropriate columns, say A1 through G1. Then it saves the results workbook, closes it, and clears the contents of the cells in the test workbook that contains the answers the user selected. Then when someone else takes the test and does the same thing, their answers are saved BELOW the first person in the results workbook, allowing me to use the same test workbook and log everyone's results n the same workbook.. I know how to call open a new workbook, save and close it, and clear the contents, but what I don't know is how to get the second or third or fourth users answers to be entered in the row below the person before them. Hope this makes sense and someone can help. Thanks!- Hide quoted text - - Show quoted text - |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What I had meant was that LastRow will give you the last filled row. So if
you want to write to the next row you will have to add 1 to LastRow variable... "GLHEC-BLS" wrote: That works great, but I don't understand the last part about adding 1. I understand this is supose to tak eit to the row below the one with the last entry, but I'm not sure where you mean to add the + 1 to the variable LastRow. This is what I have right now. Private Sub Worksheet_Activate() Dim LastRow As Long With Worksheets("Learning Style") LastRow = .Cells(.Rows.Count, "B").End(xlUp).Select End With End Sub "Sheeloo" wrote: The following code fragment will give you the last row used, in Col A, on Data Sheet in the variable LastRow... Add 1 to it and write to that row... Dim LastRow As Long With Worksheets("Data") LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row End With MsgBox LastRow "GLHEC-BLS" wrote: I have two different workbooks, a test book and a results book. I would like to have a command button, that when clicked, opens the results workbook and fill the users name and answers in the appropriate columns, say A1 through G1. Then it saves the results workbook, closes it, and clears the contents of the cells in the test workbook that contains the answers the user selected. Then when someone else takes the test and does the same thing, their answers are saved BELOW the first person in the results workbook, allowing me to use the same test workbook and log everyone's results n the same workbook. I know how to call open a new workbook, save and close it, and clear the contents, but what I don't know is how to get the second or third or fourth users answers to be entered in the row below the person before them. Hope this makes sense and someone can help. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
remove fill in text from a cell from an unpopulated fill-in cell | Excel Worksheet Functions | |||
Code to copy cell borders and fill color from one cell to another | Excel Programming | |||
Fill cells with code based on content of preceeding cell? | Excel Programming | |||
VBA code to fill rest of cell with dashes (-) | Excel Programming | |||
Can I auto fill a cell in one worksheet by typing a code number | Excel Worksheet Functions |