Solved

Find Value and Replace

Posted on 2013-06-10
3
258 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now