Using VBA code to search and minus cell value
Closed
Ly2424
-
Mar 26, 2018 at 06:09 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 27, 2018 at 11:34 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 27, 2018 at 11:34 AM
Related:
- Using VBA code to search and minus cell value
- Battery reset code - Guide
- How to get whatsapp verification code online - Guide
- Samsung volume increase code - Guide
- Vba case like - Guide
- Cs 1.6 code - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Mar 27, 2018 at 11:34 AM
Mar 27, 2018 at 11:34 AM
Hi Ly2424,
Have a look a the code below. Let the green text help you understand the code:
Best regards,
Trowa
Have a look a the code below. Let the green text help you understand the code:
Sub RunMe() Dim fCol, fRow As Range Dim cHeader, rHeader As String cHeader = Range("K1").Value 'This cell refers to the column header to lookup rHeader = Range("K2").Value 'This cell refers to the row header to lookup Set fCol = Rows(1).Find(cHeader) 'Finding the column header Set fRow = Columns("A").Find(rHeader) 'Finding the row header Cells(fRow.Row, fCol.Column).Value = Cells(fRow.Row, fCol.Column).Value - 1 'subtracting 1 End Sub
Best regards,
Trowa