By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,346 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

I need your help!

P: 2
i am trying to get Excel to remember data.

I have a sheet in my excel file where company data is entered.

i need excel to save this data to another sheet for comparison so that when another set of data is entered, this is saved next to the old data on the other sheet.

so if 3 sets of data are inputted, on the comparison page, there will be 3 sets of saved data.

i have been instructed by my lecturer that this is possible through VB

can anyone help?
Nov 16 '06 #1
Share this Question
Share on Google+
1 Reply


100+
P: 267
i am trying to get Excel to remember data.

I have a sheet in my excel file where company data is entered.

i need excel to save this data to another sheet for comparison so that when another set of data is entered, this is saved next to the old data on the other sheet.

so if 3 sets of data are inputted, on the comparison page, there will be 3 sets of saved data.

i have been instructed by my lecturer that this is possible through VB

can anyone help?
hi

create a button on your 1st sheet and call this cmdSave
then copy and paste the following ...

assuming data on sheet(1) is in column A (1-20)
the macro is searching for an empty column on sheets(2) starting with A
and copies it, sweeping column A on sheets(1) afterwards


Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdSave_Click()
  3. i = 0
  4. While Not Sheets(2).Range("a1").Offset(0, i) = vbNullString
  5. i = i + 1
  6. Wend
  7. NewAddress = Chr(65 + i) & "1:" & Chr(65 + i) & "20"
  8. Sheets(2).Range(NewAddress).Value = Sheets(1).Range("a1:a20").Value
  9. Sheets(1).Range("a1:a20").CearContents
  10. End Sub
  11.  
  12.  
Nov 16 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.