The missing quines: Visual Basic (for Applications)
Tag : vba , By : negonicrac
Date : March 29 2020, 07:55 AM
it fixes the issue I don't know if anybody reads this thread anomore but here's an even shorter one, based on the quine of das_weezul. It's independent of "Option Explicit" (unlike das_weezul's) and it's independent of the Office App you are working in (i.e. Excel, Access, Word etc.) - unlike Alex K's. Use it in the immediate window (Ctrl+G): c="c=#:?replace(c,chr(35),chr(34) &c &chr(34))":?replace(c,chr(35),chr(34) &c &chr(34))
|
Count cells that contain certain letters (Visual Basic)
Tag : excel , By : rhinojosa
Date : March 29 2020, 07:55 AM
Hope that helps You can loop through each cell in the range and use INSTR to find if the cell contains the text. Increment a counter if it does and then output it. Function findText(myRange As Range, toFind As String)
Dim ra As Range
Dim rCount As Integer
rCount = 0
For i = 1 To myRange.Rows.Count
If InStr(1, myRange(i, 1), toFind, vbTextCompare) Then
rCount = rCount + 1
End If
Next i
findText = rCount
End Function
If myRange(i, 1) = toFind Then
|
Visual Basic for Applications
Tag : excel , By : Ryan Adriano
Date : March 29 2020, 07:55 AM
hop of those help? Include this macro to the sheet and run everytime when you have a new value in cell F10, Sub F10()
Dim i As Long
i = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & i + 1) = Range("F10")
End Sub
Private Sub worksheet_change(ByVal target As Range)
If target.Address = "$F$10" Then
Dim i As Long
i = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & i + 1) = Range("F10")
End If
End Sub
|
Visual Basic for Applications Query
Tag : excel , By : user124112
Date : March 29 2020, 07:55 AM
Hope that helps As jsheenran pointed out, you only run the randomized colors once in the first snippet, while you run the randomized colors multiple times in the second snippet. Why Code 1 only generates one color: Sub ColorLoop()
Dim red As Long
Dim green As Long
Dim blue As Long
Dim c As Range
red = Application.WorksheetFunction.RandBetween(0, 255) ' Let's say the result=1
blue = Application.WorksheetFunction.RandBetween(0, 255)' Let's say the result=10
green = Application.WorksheetFunction.RandBetween(0, 255)'Let's say the result=20
' From here the red,blue, green are constant and every cell in the loop will have:
For Each c In selection
c.Interior.Color = RGB(1, 10, 20)
Next c
End Sub
|
How to get started with Visual Basic for Applications?
Date : March 29 2020, 07:55 AM
|