Another approach using dictionary [code] Private Sub UserForm_Initialize() Dim arr As Variant arr = GetDistinct(Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)) ListBox1.List =...
Thanks a lot PNRao for this great solution Another approach using collection [code] Private Sub UserForm_Initialize() Dim ws As Worksheet...
Thanks vaali... this is the data sheet1 data EID NAME PAY PayDay 14123 Joe1 $1,234.00 29-Jun-17 14124 Joe2...
HI, Here is the required macro to search a field and if value found copy the whole row into another...
I found a solution like this :Records in between two specific dates easily can be filtered using drop-down lists ....
I found a solution as follows: Watch the video to see how it's done and download example file : https://youtu.be/SZduAoOtiS0
I have sorted the above problem. Code is given below... [code] Sub seperate() Call CleanSheets MsgBox "1 of 10 Cleaning...
I have to check in Column A whether any number starts with 113 or 114 and the corresponding value for that cell in Column B is positive or negative and if it is negative, then in Column C against that cell enter value as A. Otherwise Column C should be blank.
I wrote the macro given below, but it is not working.
Dim c As Range
For Each c In Range("a1:a5")
For Each d In Range("b1:b5")
For Each e In Range("c1:c5")
If c.Value = "" Then
e.Value = ""
If ((Left(c.Value, 3) = 113 Or Left(c.Value, 3) = 114)) And sgn (d.Value) = -1 Then
e.Value = "A"
Can anybody help please.
Thanks in advance……
Hi, Here is the updated VBA Macro fro your requirement:
In this macro, we are looping through from 1 to 5. And Checking if A1 is starts with 113 or 114, if B1 is a negative value.
If this meets the condition we are printing letter “A” in C1 other wise Blank.
The loop will continue check the A2,A3..up to A5.
Dim c As Range
'Loop through From Row 1 to 5
For iCntr = 1 To 5
'Check if its meeting the criterian
If (Left(Range("A" & iCntr), 3) = 113 Or Left(Range("A" & iCntr), 3) = 114) And Range("B" & iCntr) < 0 Then
Range("C" & iCntr) = "A" 'Enter A if meets
Range("C" & iCntr) = "" 'Other wise Blank
Thanks for the detailed and informative answer………
Please share using the share button above.
If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.
Found the answer useful and wants to credit the user, then vote the answer (vote up).