Solved

# Loop question

Posted on 2013-11-07
196 Views
Hi Guys, I want to do a Loop down Column "BA" of my spreadsheet and if a Cell has Value in it to populate the same Cells in Columns "AD" & "AE" with the following comments "Non Validated  trade" and "Dashboard". The Previous Business Date has to be column AJ .How do I write the code for this?
0
Question by:Justincut

LVL 21

Expert Comment

ID: 39630579
i'd use if formula here , just much more natural to excel , just type "=if" in  "AD" & "AE"  and follow the instructions
0

LVL 33

Expert Comment

ID: 39630597
What does this mean?

The Previous Business Date has to be column AJ
0

Author Comment

ID: 39630625
The Previous Business Date would be populated to the same row as where there's values in Column BA, eg. today it would populate "06/11/2013". I don't want a formula as this is a column where many commentaries must be written.
0

LVL 33

Expert Comment

ID: 39630647
Do you mean as well as putting values in AD and AE you want the previous business day in AJ?
0

LVL 12

Accepted Solution

Harry Lee earned 500 total points
ID: 39632156
Is this what you want?

``````Sub checkifvalue()
Dim I As Integer, WS As Worksheet, ADString As String, AEString As String, AJString As String

AEString = "Dashboard"
AJString = Format(Application.WorksheetFunction.WorkDay(Now(), -1), "MM/DD/YYYY")
Set WS = ActiveSheet

For I = 2 To WS.Cells(Rows.Count, 53).End(xlUp).Row
If IsNumeric(WS.Cells(I, 53)) Then
WS.Cells(I, 31) = AEString
WS.Cells(I, 36) = AJString
End If
Next
Columns.AutoFit
End Sub
``````
0

## Featured Post

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …