0% found this document useful (0 votes)
2 views

Counting

The document contains VBA code for Excel that defines several functions and subroutines. It includes functions to get and set cell values, find the last row in a column, create and copy a new sheet, and count occurrences of values in a specific column. The code is designed to manipulate Excel worksheets and perform operations based on the data within them.

Uploaded by

040601is
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Counting

The document contains VBA code for Excel that defines several functions and subroutines. It includes functions to get and set cell values, find the last row in a column, create and copy a new sheet, and count occurrences of values in a specific column. The code is designed to manipulate Excel worksheets and perform operations based on the data within them.

Uploaded by

040601is
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Function getValue(sht, i, j)

getValue = Worksheets(sht).Cells(i, j).Value

End Function

Sub setValue(sht, i, j, target)


Worksheets(sht).Cells(i, j) = target

End Sub

Sub AddSheet(sname)
Sheets.Add.Name = sname

End Sub

Function FindLastRow(wksh, col)


FindLastRow = Worksheets(wksh).Cells(Rows.Count, col).End(xlUp).Row

End Function

Sub CreateANDCopy()

Sheets.Add after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = "Sheet0"

Sheets("Sheet0").Columns(1).Value =
Sheets("2_LIC_R_Licencee_ESer_2").Columns(2).Value
Sheets("Sheet0").Rows(1).EntireRow.Delete

End Sub

Sub CountEService()

lastrowB = FindLastRow("Sheet0", "B")


Dim efftotal As Integer
efftotal = 0

For i = 1 To lastrowB
Var = Application.Match(Worksheets("Sheet0").Cells(i, 2).Value,
Worksheets("Sheet0").Columns(1), 0)

If Not IsError(Var) Then


efftotal = efftotal + 1

End If

Next i

MsgBox (efftotal)

End Sub

You might also like