?
Solved

Loop question

Posted on 2013-11-07
5
Medium Priority
?
207 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 35

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 35

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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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.

840 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