How deal with this complicated code and updating(subtraction between two sheets)
Solved/Closed
Hasson_6770
Posts
18
Registration date
Monday August 2, 2021
Status
Member
Last seen
May 23, 2022
-
Updated on Aug 24, 2021 at 03:34 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 27, 2021 at 11:23 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 27, 2021 at 11:23 AM
Related:
- How deal with this complicated code and updating(subtraction between two sheets)
- Battery reset code - Guide
- Samsung volume increase code - Guide
- How to get whatsapp verification code online - Guide
- Cs 1.6 code - Guide
- Samsung keypad reset code - Guide
3 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Sep 21, 2021 at 11:49 AM
Sep 21, 2021 at 11:49 AM
Hi Hasson,
It can be frustating when an OP alters the query, but I'm pretty sure that it's not OP's intent to waste anyone's time.
On to your questions:
Let me post back your file. I made 2 adjustments to the Subtract_Likes code. These 2 points were just anoying me: Autofitting the rows and disabling the message about replacing the data.
Here is your file:
https://wetransfer.com/downloads/1d473cab2c4cc2ab61637059dc9dc27b20210921154900/79a11e
You can run both codes individually after each other or run RunBothCodes.
Best regards,
Trowa
It can be frustating when an OP alters the query, but I'm pretty sure that it's not OP's intent to waste anyone's time.
On to your questions:
- Yes I got your file.
- The code I provided was supposed to be run after the Substract_Likes code, to update the numbers on the RS sheet.
Let me post back your file. I made 2 adjustments to the Subtract_Likes code. These 2 points were just anoying me: Autofitting the rows and disabling the message about replacing the data.
Here is your file:
https://wetransfer.com/downloads/1d473cab2c4cc2ab61637059dc9dc27b20210921154900/79a11e
You can run both codes individually after each other or run RunBothCodes.
Best regards,
Trowa
Hasson_6770
Posts
18
Registration date
Monday August 2, 2021
Status
Member
Last seen
May 23, 2022
Sep 13, 2021 at 10:31 PM
Sep 13, 2021 at 10:31 PM
is there any help?
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Updated on Sep 14, 2021 at 12:20 PM
Updated on Sep 14, 2021 at 12:20 PM
Hi Hasson,
The code uses a lot of stuff I'm not familiar with and I wanted to understand it as it is very efficient. It just takes longer then I thought.
In the mean time, let me provide you with an additional code to get the correct numbers:
The code seems tailor made for you. Can't you ask the one that wrote the code for you to alter it?
Best regards,
Trowa
The code uses a lot of stuff I'm not familiar with and I wanted to understand it as it is very efficient. It just takes longer then I thought.
In the mean time, let me provide you with an additional code to get the correct numbers:
Sub RunMe() Dim mFind As Range Dim mCount As Long Sheets("RS").Select For Each cell In Range("D2:D17") Set mFind = Sheets("Keys out").Columns("B").Find(cell.Value) If Not mFind Is Nothing Then firstaddress = mFind.Address Do If cell.Offset(0, 1).Value & cell.Offset(0, 2).Value = mFind.Offset(0, 1).Value & mFind.Offset(0, 2).Value Then mCount = mCount + mFind.Offset(0, 3).Value End If Set mFind = Sheets("Keys out").Columns("B").FindNext(mFind) Loop While mFind.Address <> firstaddress End If Set mFind = Sheets("SH").Columns("E").Find(cell.Value) If Not mFind Is Nothing Then firstaddress = mFind.Address Do If cell.Offset(0, 1).Value & cell.Offset(0, 2).Value = mFind.Offset(0, 1).Value & mFind.Offset(0, 2).Value Then mCount = mCount - mFind.Offset(0, 3).Value End If Set mFind = Sheets("SH").Columns("E").FindNext(mFind) Loop While mFind.Address <> firstaddress End If cell.Offset(0, 3).Value = mCount mCount = 0 Next cell End Sub
The code seems tailor made for you. Can't you ask the one that wrote the code for you to alter it?
Best regards,
Trowa
Hasson_6770
Posts
18
Registration date
Monday August 2, 2021
Status
Member
Last seen
May 23, 2022
>
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
Sep 15, 2021 at 01:59 PM
Sep 15, 2021 at 01:59 PM
Hi Trowa,
first thanks for try providing me another solution . but unfortnutly it doesn't subtract and gives minus values . the orginal code creates whole data in sheet RS , but your code and before subtract the values . I have to write data from COL A: F and match the data .then subtract and show the values in COL G, am I right about your code?
I no know if you saw my file and some comments and highlighted cells in all sheets
if this is not clear . I will provide more detailes
thanks for your help
first thanks for try providing me another solution . but unfortnutly it doesn't subtract and gives minus values . the orginal code creates whole data in sheet RS , but your code and before subtract the values . I have to write data from COL A: F and match the data .then subtract and show the values in COL G, am I right about your code?
I no know if you saw my file and some comments and highlighted cells in all sheets
if this is not clear . I will provide more detailes
thanks for your help
Hasson_6770
Posts
18
Registration date
Monday August 2, 2021
Status
Member
Last seen
May 23, 2022
Updated on Sep 14, 2021 at 12:32 PM
Updated on Sep 14, 2021 at 12:32 PM
Hi Trowa,
The code seems tailor made for you. Can't you ask the one that wrote the code for you to alter it?
you 're extremely right . actually I did it and ask for him repeatedly . but it doesn't seem to answer me because I don't make clear my requirments from the beggining .despite of he adjust many codes for others members but about my case ignores me totally that's why I search for another body to help me . I barly lose my mind I don't find solution so far .
about your code I will test it and inform you as soon possible
thanks for your help
The code seems tailor made for you. Can't you ask the one that wrote the code for you to alter it?
you 're extremely right . actually I did it and ask for him repeatedly . but it doesn't seem to answer me because I don't make clear my requirments from the beggining .despite of he adjust many codes for others members but about my case ignores me totally that's why I search for another body to help me . I barly lose my mind I don't find solution so far .
about your code I will test it and inform you as soon possible
thanks for your help
Sep 22, 2021 at 09:27 AM
best regards,
Hasson
Sep 23, 2021 at 11:00 AM
After running the code in module 1, the top result is wrongly 7. After running the code in module 2, the top result is correctly updated to 2.
The code in module 1 is still the same code with the 2 adjustments mentioned in the previous post. The code I added in module 2 updates the numbers on the RS sheet. For convenience sake I added the macro RunBothCodes, hit ALT+F8 and double click RunBothCodes to get the right result immediately.
Are you saying that after you run both codes you still get the wrong results?
Best regards,
Trowa
Updated on Sep 23, 2021 at 11:10 AM
Are you saying that after you run both codes you still get the wrong results?
no. the second code works and gives right value . but I thought to you adjusted the first code.
the first code has advantage create whole data . but your code doesn't do that. I have to write the data manually and bring the values , if I have a big data then it will take from me more time to writing . I know the first code is complicated and not to easy to mod . actually I appreciate your assistance .
thanks again
Sep 23, 2021 at 11:37 AM
It seems you have an issue with running 2 codes ...
I fail to see the problem; Use the module 1 code to bring in the data, so you DON'T have to write the data manually. Use the module 2 code to get the right numbers, so you DON'T have to recalculate manually.
So yeah, the first code creates the whole data, but get the numbers wrong. My code doesn't create the whole data, but gets the numbers right. Both codes support each other to create the desired result.
Am I missing something?
Best regards,
Trowa
Sep 23, 2021 at 11:51 AM
ah! I got it . I have to depend on two codes together . I thought to choose one code to do all of things .
smart work !
thanks so much for your assistance