Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Find Value and Replace

Posted on 2013-06-10
3
Medium Priority
?
288 Views
Last Modified: 2013-06-10
Hello, needing a macro to perform the following:

I have a sheet that ingests data from the web and then I parse out the data via a macro.  What I need is in cell BG1, there will be four possible values in this cell, 00Z, 06Z, 12Z, 18Z.  Each one is a time reference like 18Z is 18 UTC time.  Based on which value is in BG1, I need make BE2=BG1, then add one hour and put that vlaue in BF 2, add another hour and put that value in BG 2.

I need this in a macro format as I have to clear the data often and the formulas will get deleted.
Sample1.xlsx
0
Comment
Question by:sandramac
[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
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 2000 total points
ID: 39236265
This macro should get you the results you want:
Sub FormatTime()
Dim i, x As Integer

i = Left(Range("BG1").Value, 2)
Range("BE2").Select
For x = 1 To 19
  If i > 23 Then
    i = 0
  End If
    ActiveCell.Value = i
    i = i + 1
    ActiveCell.Offset(0, 1).Select
Next x

End Sub

Open in new window

Flyster
0
 

Author Closing Comment

by:sandramac
ID: 39236302
Awesome, thank you that is what I needed.
0
 
LVL 22

Expert Comment

by:Flyster
ID: 39236392
Glad I could help!
0

Featured Post

Independent Software Vendors: 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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

704 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