468,301 Members | 1,530 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

I need your help!

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
1 796
albertw
267 100+
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.

Similar topics

6 posts views Thread by mike | last post: by
5 posts views Thread by John Flynn | last post: by
reply views Thread by xunling | last post: by
7 posts views Thread by Timothy Shih | last post: by
8 posts views Thread by skumar434 | last post: by
reply views Thread by U S Contractors Offering Service A Non-profit | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.