I do not know why this does this. But I was able to work around the problem. Please try this...
Maybe try declaring the FSO as Object. "Dim FSO" without a declaration declares the FSO as a variant. Just a...
Each block is a named range. There are 6 Key colors which are based on the information in column “Y”(Rental...
I cleaned up the code. This will place next month and year in cell A1. So today is Sep30 2018...
This was tested in a blank worksheet (no data). The macro will place next Month and Year in cell A1....
Updated the code to include the possibility of blank cells in the raw data. If a blank cell is found...
Lets try this again. You will need 3 sheets. Sheet1, Sheet 2 and Sheet3 Sheet1 your raw data Sheet2 is...
Hey Thank you so much. Apologies for not been very clear on the question. Using your example, in the output...
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).