Solved

Loop question

Posted on 2013-11-07
5
202 Views
Last Modified: 2013-11-08
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
Comment
Question by:Justincut
5 Comments
 
LVL 21

Expert Comment

by:oleggold
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

by:Norie
ID: 39630597
What does this mean?

The Previous Business Date has to be column AJ
0
 

Author Comment

by:Justincut
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

by:Norie
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

by:
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

ADString = "Non Validated Trade"
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, 30) = ADString
        WS.Cells(I, 31) = AEString
        WS.Cells(I, 36) = AJString
    End If
Next
Columns.AutoFit
End Sub

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question