• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I want to edit and update data array in sheet data

hoanhnnc

New Member
Dear All,

Please help me to fix code how to call data from sheet data and update again to sheet data.



Thanks,
 

Attachments

  • test.xlsm
    64 KB · Views: 4
Hoac, you'll need to tell us what exactly is not working in your program. I see lots of code, but instead of asking everyone to look at it and figure out what you want it to do and what it's doing instead, you should just tell us what to look for.
 
I want to call data array of 31 days 8 row appear in "time" sheet. After edit and update new numbers to data sheet. Thanks
 
Hoac, you'll need to tell us what exactly is not working in your program. I see lots of code, but instead of asking everyone to look at it and figure out what you want it to do and what it's doing instead, you should just tell us what to look for.
I just test tested only row 5 of sheet data when click "sua" mean "update" botton. Can you pkease test you wil understand
 
You should read this. When you post in multiple locations, it is often counter intuitive. You think you will get answers faster, yet many helper avoid crossposters like the plague.

 
Well, I see one problem. (I don't know whether it's THE problem; there may be more than one.) You defined Arr(1 To 31, 1 To 8), but in the loop you incremented Ngay from 1 to 31 and used that in Arr(<row>, Ngay). So you put data in the Arr up to column 8, and everything after that failed ("subscript out of range").

You didn't see that because you included the statement "On Error Resume Next"; instead of stopping and telling you there's an error, the program just went on not doing what you wanted it to do, but not informing you.

I spotted the problem by using <F8>, stepping through the program one statement at a time and looking at the value of variables as I went. This is really useful for debugging!
 
Well, I see one problem. (I don't know whether it's THE problem; there may be more than one.) You defined Arr(1 To 31, 1 To 8), but in the loop you incremented Ngay from 1 to 31 and used that in Arr(<row>, Ngay). So you put data in the Arr up to column 8, and everything after that failed ("subscript out of range").

You didn't see that because you included the statement "On Error Resume Next"; instead of stopping and telling you there's an error, the program just went on not doing what you wanted it to do, but not informing you.

I spotted the problem by using <F8>, stepping through the program one statement at a time and looking at the value of variables as I went. This is really useful for debugging!
Can you please fix this error and Update for remain rows?

Please help me to fix code I do not understand well about array I learn myself. Ability is limited.


Thanks,
 

Attachments

  • Test.xlsm
    100.1 KB · Views: 0
I won't fix it for you, but I will teach you how to figure it out and fix it for yourself. That way you'll be able to write your own programs much more skillfully.

Let's start over: When you push the button labeled "Sua" in the Time worksheet, what did you want it to do in the Data worksheet? It looks to me like you want the program to change all the values in the worksheet to some starting value—or maybe to rearrange the data somehow. What, exactly?
 
Back
Top