Solved

Find Value and Replace

Posted on 2013-06-10
3
278 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 500 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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
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…

630 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