Barney bull
New Member
- Joined
- Apr 21, 2024
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi, I have some code that works fine for figures from 1to 9, but when I get to 0 it returns an error.
Example.
Sub verticaltabs()
Dim SelRow as long
Dim FirstRow as long
SelRow = Right(ActiveCell.Row,1) - 5
With sheet1
.Range(“65:144”).EntireRow.hidden = True
FirstRow = 65 + ((SelRow - 1) * 20)
.Range(FirstRow &”:”& FirstRow + 19).EntireRow.Hidden = False
.Range(“B3”).Value = SelRow +FirstRow
As mentioned earlier this formula works well until you get to a 0. Example 109 right most digit is 9 however when you have 110 the right most digit is a 0. How can I fix this issue can anyone help please
Example.
Sub verticaltabs()
Dim SelRow as long
Dim FirstRow as long
SelRow = Right(ActiveCell.Row,1) - 5
With sheet1
.Range(“65:144”).EntireRow.hidden = True
FirstRow = 65 + ((SelRow - 1) * 20)
.Range(FirstRow &”:”& FirstRow + 19).EntireRow.Hidden = False
.Range(“B3”).Value = SelRow +FirstRow
As mentioned earlier this formula works well until you get to a 0. Example 109 right most digit is 9 however when you have 110 the right most digit is a 0. How can I fix this issue can anyone help please