Created
March 8, 2020 02:30
-
-
Save guinslym/413b8c7b5f16f4d1685216e794637f75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub count_total_nb_of_rows_and_delete_some_rows() | |
Dim last_row As Long | |
Dim total_row_to_remove As Integer | |
Dim randomNumber As Integer | |
Dim counter | |
last_row = Cells(Rows.Count, 1).End(xlUp).Row | |
MsgBox (last_row) | |
total_row_to_remove = CInt(last_row * 0.03) | |
For Row = 2 To total_row_to_remove | |
randomNumber = Int(2 + Rnd * (total_row_to_remove - 10)) | |
Debug.Print randomNumber | |
'Rows(randomNumber).EntireRow.Delete | |
Next | |
last_row = Cells(Rows.Count, 1).End(xlUp).Row | |
MsgBox (last_row) | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment