Toma Ovidiu says:
September 20, 2022 at 9:40 am
Hello can VBA code be inserted into Excel 365? if so how?
Hi!
You can record and run VBA macros with all Excel desktop versions. In the online version of Excel, VBA does not work.
Anat says:
July 11, 2022 at 8:59 am
Hi,
I'm trying to add a blank row between every row.
After running the VBA code, I get an error 6 - overflow.
When debugging, it looks like there's an issue with the following string:
CountRow = rng.EntireRow.Count
Please help me resolve this 0 Then
Paisa = GetTens[Left[Mid[MyNumber, DecimalPlace + 1] & _
"00",
2]]
MyNumber = Trim[Left[MyNumber, DecimalPlace - 1]]
End If
Count = 1
Do While MyNumber ""
Temp = GetHundreds[Right[MyNumber, 3]]
If Temp "" Then Rupees = Temp & Place[Count] & Rupees
If Len[MyNumber] > 3 Then
MyNumber = Left[MyNumber, Len[MyNumber] - 3]
Else
MyNumber = ""
End If
Count = Count + 1
Loop
If MyCurrencyPlace = "P" Then
Select Case Rupees
Case ""
Rupees = MyCurrency & "s" & " Zero"
Case "One"
Rupees = MyCurrency & " One"
Case Else
Rupees = MyCurrency & "s " & Rupees
End Select
Else
Select Case Rupees
Case ""
Rupees = "Zero " & MyCurrency & "s"
Case "One"
Rupees = "One " & MyCurrency
Case Else
Rupees = Rupees & " " & MyCurrency & "s"
End Select
End If
If MyCurrencyDecimalsPlace = "S" Then
Select Case Paisa
Case ""
Paisa = " Only"
Case "One"
Paisa = " and
One " & MyCurrencyDecimals & " Only"
Case Else
Paisa = " and " & Paisa & " " & MyCurrencyDecimals & "s Only"
End Select
Else
Select Case Paisa
Case ""
Paisa = " Only"
Case "One"
Paisa = " and " & MyCurrencyDecimals & " One " & " Only"
Case Else
Paisa = " and " & MyCurrencyDecimals & "s " & Paisa & " Only"
End Select
End If
SpellCurr = Rupees & Paisa
End Function
'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Function GetHundreds[ByVal MyNumber]
Dim Result As String
If Val[MyNumber] = 0 Then Exit Function
MyNumber = Right["000" & MyNumber, 3]
' Convert the hundreds place.
If Mid[MyNumber, 1, 1] "0" Then
Result = GetDigit[Mid[MyNumber, 1, 1]] & " Hundred "
End If
' Convert the tens and ones place.
If
Mid[MyNumber, 2, 1] "0" Then
Result = Result & GetTens[Mid[MyNumber, 2]]
Else
Result = Result & GetDigit[Mid[MyNumber, 3]]
End If
GetHundreds = Result
End Function
'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Function GetTens[TensText]
Dim Result As String
Result = "" ' Null out the temporary function value.
If Val[Left[TensText, 1]] =
1 Then ' If value between 10-19...
Select Case Val[TensText]
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99...
Select Case Val[Left[TensText, 1]]
Case
2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
[Right[TensText, 1]] ' Retrieve ones place.
End If
GetTens = Result
End Function
'*******************************************
' Converts a number from 1 to 9 into
text. *
'*******************************************
Function GetDigit[Digit]
Select Case Val[Digit]
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function
Fernanda says:
December 14, 2017 at 12:17 am
Hi, I added a VBA code for a new Formula [CONCATENATEIFS] and it works greate but the only problem is that its super slow, I tried to use your speed up tip but it ended up slower [probably because I dont know where exactly to put it because the formula doesn´t have a Sub line] Can you help me?
The formula is this one: Function ConcatenateIfs[ConcatenateRange As Range, ParamArray Criteria[] As Variant] As Variant
' Source: EileensLounge.com, August 2014
Dim i As Long
Dim c As Long
Dim n As Long
Dim f As Boolean
Dim Separator As String
Dim strResult As String
On Error GoTo ErrHandler
n = UBound[Criteria]
If n < 3 Then
' Too few arguments
GoTo ErrHandler
End If
If n Mod 3 = 0 Then
' Separator specified explicitly
Separator = Criteria[n]
Else
' Use default separator
Separator = ","
End If
' Loop through the cells of the concatenate range
For i = 1 To ConcatenateRange.Count
'
Start by assuming that we have a match
f = True
' Loop through the conditions
For c = 0 To n - 1 Step 3
' Does cell in criteria range match the condition?
Select Case Criteria[c + 1]
Case " Criteria[c + 2] Then
f = False
Exit For
End If
Case "= Criteria[c + 2] Then
f = False
Exit For
End If
Case ">="
If Criteria[c].Cells[i].Value "
If Criteria[c].Cells[i].Value