Hi all,
I’m truing to create a macro for “counting” cells that contain a particular character in multiple worksheets ( “X” in my case)
All my sheets have the same pattern (except the first which is a analysis sheet) so I have the same tables in the same position (but different inputs)
I made a macro that works but only if place the “cell” in the code (first example) :
Function numara_daca()
Application.Volatile
mylast = Worksheets.Count
For j = 2 To mylast
With Worksheets(j)
If UCase(.Range("C11")) = "X" Then
numara_daca = numara_daca + 1
End If
End With
Next j
End Function
so if i enter in a cell from my worksheet =numara_daca() only works for cell C11 and here is my problem: I want to apply macro across multiple cells without having to enter them each time in the code. I wish I could enter it in cell function like this =numara_daca(C11) or =numara_daca(D12) or something like that
I tried to create a code....but does not work...gives me: #VALUE!
Function numara_daca1(cell As Range)
Application.Volatile
mylast = Worksheets.Count
For j = 2 To mylast
With Worksheets(j)
If UCase(.Range(cell)) = "X" Then
numara_daca1 = numara_daca1 + 1
End If
End With
Next j
End Function
any idea???
I’m truing to create a macro for “counting” cells that contain a particular character in multiple worksheets ( “X” in my case)
All my sheets have the same pattern (except the first which is a analysis sheet) so I have the same tables in the same position (but different inputs)
I made a macro that works but only if place the “cell” in the code (first example) :
Function numara_daca()
Application.Volatile
mylast = Worksheets.Count
For j = 2 To mylast
With Worksheets(j)
If UCase(.Range("C11")) = "X" Then
numara_daca = numara_daca + 1
End If
End With
Next j
End Function
so if i enter in a cell from my worksheet =numara_daca() only works for cell C11 and here is my problem: I want to apply macro across multiple cells without having to enter them each time in the code. I wish I could enter it in cell function like this =numara_daca(C11) or =numara_daca(D12) or something like that
I tried to create a code....but does not work...gives me: #VALUE!
Function numara_daca1(cell As Range)
Application.Volatile
mylast = Worksheets.Count
For j = 2 To mylast
With Worksheets(j)
If UCase(.Range(cell)) = "X" Then
numara_daca1 = numara_daca1 + 1
End If
End With
Next j
End Function
any idea???