Posts

Showing posts from January, 2023

VBA MOD 01 nested loop - Loop through each cell value and each row

Image
Option Explicit Const startrow As Byte = 10 Dim lastrow As Long Public Sub For_Next_loop_in_text()     Dim i As Long 'for looping inside each cell     Dim numfound As Long     Dim textfound As String     Dim myValue As String     Dim r As Long 'looping through each rows lastrow = Range("A" & Rows.Count).End(xlUp).Row        For r = startrow To lastrow     myValue = Range("A" & r).Value     For i = 1 To VBA.Len(myValue)        If IsNumeric(VBA.Mid(myValue, i, 1)) Then        numfound = numfound & VBA.Mid(myValue, i, 1)                ElseIf Not IsNumeric(VBA.Mid(myValue, i, 1)) Then        textfound = textfound & VBA.Mid(myValue, i, 1)        End If             Next i     Range("H" & r).Value = numfound     Range...

VBA MOD 01 Project Acvtivity : Count total number of formulas in Workbook

Image
 Option Explicit Public Sub Count_WB_formulas_error_Handling() Dim Sh As Worksheet Dim CounterWS As Double Dim CounterGlobal As Double For Each Sh In ThisWorkbook.Worksheets     On Error GoTo Errorhandle            CounterWS = Sh.Cells.SpecialCells(xlCellTypeFormulas).Count Lable1:  CounterGlobal = CounterGlobal + CounterWS      Errorhandle:     If Err.Number = 1004 Then     CounterWS = 0     Resume Lable1     End If      Next Sh MsgBox CounterGlobal End Sub