D
Dave Potter
Im sorry this post is so long. I'm trying to include as much info as
possible so you can tell whats going on.
Here's the scenario:
I have a workbook with two tabs (Main & Data). The main sheet is where
the user will enter data and the data sheet is where the code will
dump the data. There is a combo box on the Main sheet from which the
user will select the current date. Now when the user the selects the
date and then enters the data on the page, the user will then click a
button (called Save Data) on the main page at which point the data
will be transfered to the Data sheet. Then when a new date is selected
from the combo box the sheet is reset to blank cells. Here is the
question. If you look at the code below the top section was written by
someone else and it all works fine. about 2/3 down you will notice a
comment section where I state that I added the rest of the lines. The
lines I added to the code will work to a point. When you click the
Save Data button the data is transfered to the Data page. BUT...
When you select a new date from the combo box the data referenced by
the code I wrote does not reset. It carries over to any date you
select. I am totally confused why my code (which I simply copied and
pasted from the previous code and changed cell references) does not
work correctly. Again, I apologize fro the length of the post.
BTW OfficeXP XL2002 WinXP pro
Thank you for reading all this.
Dave
Worksheets("Data").Range("B" & FoundOnRow) = Range("N3").Value '
Store
Worksheets("Data").Range("C" & FoundOnRow) = Range("K3").Value
' Preparer
Worksheets("Data").Range("D" & FoundOnRow) = Range("H9").Value
' GSFR
Worksheets("Data").Range("E" & FoundOnRow) = Range("H10").Value
' GSDTR
Worksheets("Data").Range("F" & FoundOnRow) = Range("H12").Value
' ST
Worksheets("Data").Range("G" & FoundOnRow) = Range("M10").Value
' OSBLC
Worksheets("Data").Range("H" & FoundOnRow) = Range("M11").Value
' OSBC
Worksheets("Data").Range("I" & FoundOnRow) = Range("M12").Value
' OSB1
Worksheets("Data").Range("J" & FoundOnRow) = Range("M13").Value
' OSB5
Worksheets("Data").Range("K" & FoundOnRow) = Range("M14").Value
' OSBOB
Worksheets("Data").Range("L" & FoundOnRow) = Range("M15").Value
' OSBQ
Worksheets("Data").Range("M" & FoundOnRow) = Range("M16").Value
' OSBD
Worksheets("Data").Range("N" & FoundOnRow) = Range("M17").Value
' OSBN
Worksheets("Data").Range("O" & FoundOnRow) = Range("M18").Value
' OSBP
Worksheets("Data").Range("P" & FoundOnRow) = Range("M19").Value
' OSBOC
Worksheets("Data").Range("Q" & FoundOnRow) = Range("M23").Value
' CSBLC
Worksheets("Data").Range("R" & FoundOnRow) = Range("M24").Value
' CSBC
Worksheets("Data").Range("S" & FoundOnRow) = Range("M25").Value
' CSB1
Worksheets("Data").Range("T" & FoundOnRow) = Range("M26").Value
' CSB5
Worksheets("Data").Range("U" & FoundOnRow) = Range("M27").Value
' CSBOB
Worksheets("Data").Range("V" & FoundOnRow) = Range("M28").Value
' CSBQ
Worksheets("Data").Range("W" & FoundOnRow) = Range("M29").Value
' CSBD
Worksheets("Data").Range("X" & FoundOnRow) = Range("M30").Value
' CSBN
Worksheets("Data").Range("Y" & FoundOnRow) = Range("M31").Value
' CSBP
Worksheets("Data").Range("Z" & FoundOnRow) = Range("M32").Value
' CSBOC
' I added these lines of code but when i save data
' and go to a different date the numbers remain on
' the new page
Worksheets("Data").Range("AA" & FoundOnRow) = Range("D20").Value
' BDBAG1
Worksheets("Data").Range("AB" & FoundOnRow) = Range("D21").Value
' BDBAG2
Worksheets("Data").Range("AC" & FoundOnRow) = Range("D22").Value
' BDBAG3
Worksheets("Data").Range("AD" & FoundOnRow) = Range("D23").Value
' CREDIT
Worksheets("Data").Range("AE" & FoundOnRow) = Range("E20").Value
' BDINI1
Worksheets("Data").Range("AF" & FoundOnRow) = Range("E21").Value
' BDINI2
Worksheets("Data").Range("AG" & FoundOnRow) = Range("E22").Value
' BDINI3
Worksheets("Data").Range("AH" & FoundOnRow) = Range("E23").Value
' CREDITINI
Worksheets("Data").Range("AI" & FoundOnRow) = Range("F20").Value
' BDAMT1
Worksheets("Data").Range("AJ" & FoundOnRow) = Range("F21").Value
' BDAMT2
Worksheets("Data").Range("AK" & FoundOnRow) = Range("F22").Value
' BDAMT3
Worksheets("Data").Range("AL" & FoundOnRow) = Range("F23").Value
' CREDITAMT
End Sub
possible so you can tell whats going on.
Here's the scenario:
I have a workbook with two tabs (Main & Data). The main sheet is where
the user will enter data and the data sheet is where the code will
dump the data. There is a combo box on the Main sheet from which the
user will select the current date. Now when the user the selects the
date and then enters the data on the page, the user will then click a
button (called Save Data) on the main page at which point the data
will be transfered to the Data sheet. Then when a new date is selected
from the combo box the sheet is reset to blank cells. Here is the
question. If you look at the code below the top section was written by
someone else and it all works fine. about 2/3 down you will notice a
comment section where I state that I added the rest of the lines. The
lines I added to the code will work to a point. When you click the
Save Data button the data is transfered to the Data page. BUT...
When you select a new date from the combo box the data referenced by
the code I wrote does not reset. It carries over to any date you
select. I am totally confused why my code (which I simply copied and
pasted from the previous code and changed cell references) does not
work correctly. Again, I apologize fro the length of the post.
BTW OfficeXP XL2002 WinXP pro
Thank you for reading all this.
Dave
Worksheets("Data").Range("B" & FoundOnRow) = Range("N3").Value '
Store
Worksheets("Data").Range("C" & FoundOnRow) = Range("K3").Value
' Preparer
Worksheets("Data").Range("D" & FoundOnRow) = Range("H9").Value
' GSFR
Worksheets("Data").Range("E" & FoundOnRow) = Range("H10").Value
' GSDTR
Worksheets("Data").Range("F" & FoundOnRow) = Range("H12").Value
' ST
Worksheets("Data").Range("G" & FoundOnRow) = Range("M10").Value
' OSBLC
Worksheets("Data").Range("H" & FoundOnRow) = Range("M11").Value
' OSBC
Worksheets("Data").Range("I" & FoundOnRow) = Range("M12").Value
' OSB1
Worksheets("Data").Range("J" & FoundOnRow) = Range("M13").Value
' OSB5
Worksheets("Data").Range("K" & FoundOnRow) = Range("M14").Value
' OSBOB
Worksheets("Data").Range("L" & FoundOnRow) = Range("M15").Value
' OSBQ
Worksheets("Data").Range("M" & FoundOnRow) = Range("M16").Value
' OSBD
Worksheets("Data").Range("N" & FoundOnRow) = Range("M17").Value
' OSBN
Worksheets("Data").Range("O" & FoundOnRow) = Range("M18").Value
' OSBP
Worksheets("Data").Range("P" & FoundOnRow) = Range("M19").Value
' OSBOC
Worksheets("Data").Range("Q" & FoundOnRow) = Range("M23").Value
' CSBLC
Worksheets("Data").Range("R" & FoundOnRow) = Range("M24").Value
' CSBC
Worksheets("Data").Range("S" & FoundOnRow) = Range("M25").Value
' CSB1
Worksheets("Data").Range("T" & FoundOnRow) = Range("M26").Value
' CSB5
Worksheets("Data").Range("U" & FoundOnRow) = Range("M27").Value
' CSBOB
Worksheets("Data").Range("V" & FoundOnRow) = Range("M28").Value
' CSBQ
Worksheets("Data").Range("W" & FoundOnRow) = Range("M29").Value
' CSBD
Worksheets("Data").Range("X" & FoundOnRow) = Range("M30").Value
' CSBN
Worksheets("Data").Range("Y" & FoundOnRow) = Range("M31").Value
' CSBP
Worksheets("Data").Range("Z" & FoundOnRow) = Range("M32").Value
' CSBOC
' I added these lines of code but when i save data
' and go to a different date the numbers remain on
' the new page
Worksheets("Data").Range("AA" & FoundOnRow) = Range("D20").Value
' BDBAG1
Worksheets("Data").Range("AB" & FoundOnRow) = Range("D21").Value
' BDBAG2
Worksheets("Data").Range("AC" & FoundOnRow) = Range("D22").Value
' BDBAG3
Worksheets("Data").Range("AD" & FoundOnRow) = Range("D23").Value
' CREDIT
Worksheets("Data").Range("AE" & FoundOnRow) = Range("E20").Value
' BDINI1
Worksheets("Data").Range("AF" & FoundOnRow) = Range("E21").Value
' BDINI2
Worksheets("Data").Range("AG" & FoundOnRow) = Range("E22").Value
' BDINI3
Worksheets("Data").Range("AH" & FoundOnRow) = Range("E23").Value
' CREDITINI
Worksheets("Data").Range("AI" & FoundOnRow) = Range("F20").Value
' BDAMT1
Worksheets("Data").Range("AJ" & FoundOnRow) = Range("F21").Value
' BDAMT2
Worksheets("Data").Range("AK" & FoundOnRow) = Range("F22").Value
' BDAMT3
Worksheets("Data").Range("AL" & FoundOnRow) = Range("F23").Value
' CREDITAMT
End Sub