Re: Convert h:mm:ss into minutes number divide by 60 and again answer in h:mm format
HiSumit Dey,
maybe so
=HOUR(F3)+MINUTE(F3)/60
and this
=SUMIF(C3:C16,"Productive",G3:G16)
Re: Convert h:mm:ss into minutes number divide by 60 and again answer in h:mm format
HiSumit Dey,
maybe so
=HOUR(F3)+MINUTE(F3)/60
and this
=SUMIF(C3:C16,"Productive",G3:G16)
Re: Replace middle words with dash '-'; as in years, also with commas if not continuo
UDF
Function ConcNum(rng As Range) As String
Dim s$, x, i&, bu As Boolean
x = Split(rng.Value & " ")
If UBound(x) = 0 Then ConcNum = x(0): Exit Function
For i = 0 To UBound(x) - 1
s = s & ", " & Trim(x(i))
Do While Val(x(i)) = Val(x(i + 1)) - 1
bu = True: i = i + 1
Loop
If bu Then s = s & "-" & Trim(x(i)): bu = False
Next i
ConcNum = Mid(s, 3)
End Function
Display More
sample
Re: Replace middle words with dash '-'; as in years
try
Re: VBA to go to different worksheets from data in a Userform ComboBox
Hi Paul103,
maybe something like this
Re: Activating Option Button in VBA code
Hi Mike,
try this
Sub Clear_All_R1()
Range("G6:G13").ClearContents
With ActiveSheet
.DrawingObjects("Option Button 64").Value = True
.DrawingObjects("Option Button 71").Value = True
.DrawingObjects("Option Button 76").Value = True
End With
End Sub
or just this
Re: Lookup multiple values in a single cell without using Excel VBA
Hi Nabilah,
I added a macro in your file. Try again
Re: UDF to repeat strings according to parameters in a random sequence
... and maybe so
Function GenPopRSeq(rInd As Range, rDrq As Range)
Dim ind, frq, i&, j&, t$, sp
ind = rInd.Value: frq = rDrq.Value
For i = 1 To UBound(ind)
For j = 1 To frq(i, 1)
t = t & "~" & ind(i, 1)
Next j
Next i
sp = Split(Mid(t, 2), "~")
Randomize
For i = LBound(sp) To UBound(sp)
j = Int((UBound(sp) + 1) * Rnd)
t = sp(i)
sp(i) = sp(j)
sp(j) = t
Next i
GenPopRSeq = Application.Transpose(sp)
End Function
Display More
Re: how to optmise vba code
Hi lcmto,
try to make a few lines out of the loop
something like this
...
Set BBHNAV = Worksheets("BBH NAV")
With BBHNAV
LastRow = .Cells(.Rows.Count, "J").End(xlUp).Row
'For each row in the 'BBH NAV' sheet...
' For n = 2 To LastRow
' 'Unique Identifier (get a complete list of identifiers as they are used in calculation for column b which is a fill down instead of looping 1 cell at a time)
' .Range("A" & n).Value = .Range("J" & n).Value & .Range("M" & n).Value
' Next n
.Range("A2:A" & LastRow).FormulaR1C1 = "=RC[9]&RC[12]"
'Base Market Value
.Range("B2").FormulaArray = "=IFERROR(INDEX('T-1 DATA'!G$1:G$1000,MATCH(1,('T-1 DATA'!A$1:A$1000='BBH NAV'!A2)*('T-1 DATA'!D$1:D$1000='BBH NAV'!L2),0),1)," & """NO DATA""" & ")"
.Range("B2:B" & LastRow).FillDown
For n = 2 To LastRow
' 'Base Market Value
' .Range("B2").FormulaArray = "=IFERROR(INDEX('T-1 DATA'!G:G,MATCH(1,('T-1 DATA'!A:A='BBH NAV'!A2)*('T-1 DATA'!D:D='BBH NAV'!L2),0),1)," & """NO DATA""" & ")"
' .Range("B2:B" & LastRow).FillDown
...
Display More
Re: Vba function to concatenate header with exclusive values
slight changes
Function Kramerica2(rA As Range, rB As Range, rC As Range)
Dim a, b, c, i&, j&, s$, t$
a = rA.Value
b = rB.Value
c = rC.Value
For j = 1 To UBound(a, 2)
For i = 1 To UBound(b)
If b(i, j) <> 0 Then
t = "~" & a(1, j) & b(i, j) & c(1, j)
If InStr(s, t) = 0 Then s = s & t
End If
Next i
Next j
Kramerica2 = Application.Transpose(Split(Mid(s, 2), "~"))
End Function
Display More
Re: Macro runs slow when multiple subs are called
Hi Artie5678,
it may be easier to use cell shading instead of creating AutoShapes. Try changing this part of the code in the CreateChartBars procedure
...
Else
'Determine location of rectangle
' Left = 1 + Range(Cells(1, 1), Cells(1, LeftBarCol - 1)).Width
' Top = 1 + Range(Cells(1, 1), Cells(a - 1, 1)).Height
' Width = -1 + Range(Cells(1, LeftBarCol), Cells(1, RightBarCol)).Width
' Height = Cells(a, 1).Height
Range(Cells(a, LeftBarCol), Cells(a, RightBarCol)).Interior.ColorIndex = 43 '<~~~ This line
End If
...
and I think you've written a lot of redundant code
Re: UDF results changing when clicking on different sheets
maybe so
Function ConcatenarIntervalos(items As Range, items2 As Range, limite As Integer) As Variant
'Dim i As Integer
Dim j As Integer, result As String
'Dim k As Integer
'i = items.Row
'k = items2.Row
limite = WorksheetFunction.Min(items2.Columns.Count, limite)
For j = 4 To limite + 3
' result = result & Cells(i, j) & Cells(k, j)
result = result & items(1, j) & items2(1, j)
Next j
ConcatenarIntervalos = result
End Function
Display More