Forum Discussion
Question related to VBA
- Jul 30, 2021
LONG is the numerical data type and Dim r AS LONG means the variable r will hold the numerical value.
I could write the code without declaring any variable but I did it to make it easy for you to follow so that you can tweak it yourself if required.
Alternatively, you may try one line of code to do this...
Sub DeleteRows() Rows(ActiveCell.Row - 1).Delete End SubIf that takes care of your original question, please take a minute to accept the post with the proposed solution as a Best Response to mark your question as Solved.
You may try something like this...
The following code will delete the row from the ActiveSheet.
Sub DeleteRow()
Dim r As Long
r = ActiveCell.Row - 1
Rows(r).Delete
End Sub
- ExcelJul 30, 2021Iron ContributorSir, why we use LONG as declaration?
What is the use of LONG in VBA code?- Subodh_Tiwari_sktneerJul 30, 2021Silver Contributor
LONG is the numerical data type and Dim r AS LONG means the variable r will hold the numerical value.
I could write the code without declaring any variable but I did it to make it easy for you to follow so that you can tweak it yourself if required.
Alternatively, you may try one line of code to do this...
Sub DeleteRows() Rows(ActiveCell.Row - 1).Delete End SubIf that takes care of your original question, please take a minute to accept the post with the proposed solution as a Best Response to mark your question as Solved.
- ExcelJul 30, 2021Iron ContributorThank you so much sir😊