Hey everyone!
My data has a Time_Stamp column (see table below). My data is broken up by week.
I need to create some VBA code that looks at the Time_Stamp column, and then looks at the week column and fills in the corresponding columns for Hour (Hour1, Hour2, Hour3, or Hour4) and Minute (Minute1, Minute2, Minute3, or Minute4).
So if the time is 13:07 (1:07pm), and the week is week 1, Hour1= 1 and Minute1= 00. All other time fields in that row should be blank.
If the event occurs within 00-29 it equals 00. If the event occurs within 30-59 it equals 30.
Also I can only have the hours of 9:00am-2:30pm available. If it is past these hours nothing is filled in these columns and TimeNA1 (TimeNAWeek#), is filled in with a 1. The number 1 is the default for all of the NA columns.
All help is appreciated Thanks everyone for the assistance, still learning VBA!
<style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr class="tableizer-firstrow"><th>Time_Stamp</th><th>Week</th><th>Hour1</th><th>Minute1</th><th>Hour2</th><th>Minute2</th><th>Hour3</th><th>Minute3</th><th>Hour4</th><th>Minute4</th><th>TimeNA1</th><th>TimeNA2</th><th>TimeNA3</th><th>TimeNA4</th></tr> <tr><td>1/14/2011 13:07</td><td>1</td><td>1</td><td>00</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>5/3/2011 9:41</td><td>4</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>9</td><td>30</td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>2/26/2011 10:16</td><td>2</td><td> </td><td> </td><td>10</td><td>00</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>8/9/2010 16:29</td><td>3</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>1</td><td> </td></tr> <tr><td>6/18/2010 11:53</td><td>3</td><td> </td><td> </td><td> </td><td> </td><td>11</td><td>30</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>5/3/2011 14:28</td><td>2</td><td> </td><td> </td><td>2</td><td>00</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>4/11/2011 8:53</td><td>1</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>1</td><td> </td><td> </td><td> </td></tr> <tr><td>3/29/2011 12:32</td><td>4</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>12</td><td>30</td><td> </td><td> </td><td> </td><td></td></tr></table>
<STYLE type=text/css>
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</STYLE>
<STYLE type=text/css>
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</STYLE>
<STYLE type=text/css>
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</STYLE>
My data has a Time_Stamp column (see table below). My data is broken up by week.
I need to create some VBA code that looks at the Time_Stamp column, and then looks at the week column and fills in the corresponding columns for Hour (Hour1, Hour2, Hour3, or Hour4) and Minute (Minute1, Minute2, Minute3, or Minute4).
So if the time is 13:07 (1:07pm), and the week is week 1, Hour1= 1 and Minute1= 00. All other time fields in that row should be blank.
If the event occurs within 00-29 it equals 00. If the event occurs within 30-59 it equals 30.
Also I can only have the hours of 9:00am-2:30pm available. If it is past these hours nothing is filled in these columns and TimeNA1 (TimeNAWeek#), is filled in with a 1. The number 1 is the default for all of the NA columns.
All help is appreciated Thanks everyone for the assistance, still learning VBA!
<style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr class="tableizer-firstrow"><th>Time_Stamp</th><th>Week</th><th>Hour1</th><th>Minute1</th><th>Hour2</th><th>Minute2</th><th>Hour3</th><th>Minute3</th><th>Hour4</th><th>Minute4</th><th>TimeNA1</th><th>TimeNA2</th><th>TimeNA3</th><th>TimeNA4</th></tr> <tr><td>1/14/2011 13:07</td><td>1</td><td>1</td><td>00</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>5/3/2011 9:41</td><td>4</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>9</td><td>30</td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>2/26/2011 10:16</td><td>2</td><td> </td><td> </td><td>10</td><td>00</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>8/9/2010 16:29</td><td>3</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>1</td><td> </td></tr> <tr><td>6/18/2010 11:53</td><td>3</td><td> </td><td> </td><td> </td><td> </td><td>11</td><td>30</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>5/3/2011 14:28</td><td>2</td><td> </td><td> </td><td>2</td><td>00</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td>4/11/2011 8:53</td><td>1</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>1</td><td> </td><td> </td><td> </td></tr> <tr><td>3/29/2011 12:32</td><td>4</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>12</td><td>30</td><td> </td><td> </td><td> </td><td></td></tr></table>
<STYLE type=text/css>
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</STYLE>
<STYLE type=text/css>
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</STYLE>
<STYLE type=text/css>
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</STYLE>