Showing posts with label VBA. Show all posts
Showing posts with label VBA. Show all posts

Friday, July 28, 2023

Repeating Rows at the bottom of each printed excel sheet using VBA

 Sub MyFooter()

Dim StrFtr As String, Rng As Range, Sh As Worksheet, c As Range

Set Sh = Worksheets("Sheet5")

Set Rng = Sh.Range("A55:G55")


For Each c In Rng

StrFtr = StrFtr & c & " "

Next c


ActiveSheet.PageSetup.LeftFooter = StrFtr

End Sub

Hide rows in excel based on cell value using VBA

Sub HideRow()
LineStart = 2
LineEnd = 16
ColumnNumber = 2
For i = LineStart To LineEnd
If Cells(i, ColumnNumber).Value <> "YourCellValue" Then
Cells(i, ColumnNumber).EntireRow.Hidden = True
Else
Cells(i, ColumnNumber).EntireRow.Hidden = False
End If
Next i
End Sub

How to get Ranking of the Students in Excel using RANK Function

=RANK(number,ref,[order]) To rank in descending order, we will use the formula =RANK(B2,($C$5:$C$10),0) If we want unique ranks, we can use...