Solved

Loop question

Posted on 2013-11-07
5
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

726 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