Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing ****fs macro.

I am using Excel to keep track of shifts. I have three ****s and each are at
different times. I need a macro that will look through one column of start
times and determines which shift (A, B, C) to put in another column.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Comparing ****fs macro.

Sub fillInShiftColumn()
Dim cell as Range
for each cell in
Range(cells(2,Activecell.Column),cells(20,ActiveCe ll.Column))
if cell.Value = "A" then
cell.offset(0,1).value = "B"
elseif cell.Value = "B" then
cell.offset(0,1).Value = "C"
elseif cell.Value = "C" then
cell.offset(0,1).ClearContents
elsif cell.Value = "" then
cell.offset(0,1).Value = "A"
end if
Next
End sub

or you said times

Sub fillInShiftColumna()
Dim timeA1 as Date, timeA2 as Date, timeB1 as Date
Dim timeB2 as Date, timeC1 as Date, timeC2 as Date
TimeB1 = TimeValue("8:00:00 AM")
TimeB2 = TimeValue("3:59:59 PM")
TimeA1 = TimeValue("4:00:00 PM")
TimeA2 = TimeValue("11:59:59 PM")
TimeC1 = TimeValue("00:00:00 AM")
TimeC2 = TimeValue("7:59:59 AM")
Dim cell as Range
for each cell in
Range(cells(2,Activecell.Column),cells(20,ActiveCe ll.Column))
if cell.Value = TimeB1 and cell.Value <= TimeB2 then
cell.offset(0,1).value = "B"
elseif cell.Value = TimeC1 and cell.Value <= TimeC2 then
cell.offset(0,1).Value = "C"
elseif cell.Value = TimeA1 and cell.Value M= TimeA2 then
cell.offset(0,1).Value = "A"
end if
Next
End sub

This may help you realize you need to enrich your description.

--
Regards,
Tom Ogilvy


"Co-Op dude" <Co-Op wrote in message
...
I am using Excel to keep track of shifts. I have three ****s and each are
at
different times. I need a macro that will look through one column of
start
times and determines which shift (A, B, C) to put in another column.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing ****fs macro.

I apoligize for not being more thurough.

What I have is three shifts: A = 23:00 - 6 :59; B = 7:00 - 14:59; and C =
15:00 - 22:59.

In one column will be the times and another will be for the shift letter.
What I wanted to do was go through the column with the times listed and
determine which shift it belonged to and then print the shift letter in the
other blank column.

If you need anymore information please ask.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Comparing ****fs macro.

Sub fillInShiftColumn()
Dim cell as Range, tm as Date
Dim v as Variant, v1 as Variant
for each cell in Range(cells(2, _
Activecell.Column),cells(20,ActiveCell.Column))
v = ("6:59","14:59","22:59", "11:49")
v1 = ("A","B","C","A")
for i = lbound(v) to ubound(v)
tm = TimeValue(v(i))
if cell.Value <= v(i) then
cell.offset(0,1) = v1(i)
end if
Next
Next
End sub

--
Regards,
Tom Ogilvy


"Delphi Student" <Delphi wrote in message
...
I apoligize for not being more thurough.

What I have is three shifts: A = 23:00 - 6 :59; B = 7:00 - 14:59; and C =
15:00 - 22:59.

In one column will be the times and another will be for the shift letter.
What I wanted to do was go through the column with the times listed and
determine which shift it belonged to and then print the shift letter in
the
other blank column.

If you need anymore information please ask.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for comparing Hotel Prices dilettante Excel Programming 6 August 24th 06 02:56 AM
comparing text with macro Michael A Excel Programming 1 March 12th 05 04:05 AM
Macro (?) for comparing 2 Excel files/sheets Ex`cited Excel Programming 1 October 25th 04 12:45 PM
Macro for comparing two spreadsheets Sunny[_5_] Excel Programming 1 October 2nd 04 12:44 PM
Macro for comparing 2 values (number and date) marthab Excel Programming 2 August 19th 04 10:21 PM


All times are GMT +1. The time now is 12:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"