Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a macro to input data

I am a scheduler and I am trying to figure out a way to count the hours of
open schedules that I have due to attrition. I have a spreadsheet with the
times of the day, in 30 minute increments, listed across the top. I am
inputting a time, say 11:00am, and a number of hours, say 4, and I would like
the macro to place a number "1" beginning at 11:00am in each box for the
alloted increments, in this case 8, since it is 4 hours. I have tried all
that I know how and I can't get it to work.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 180
Default Using a macro to input data

Hi Sandi,

I think the below code will help.
I assume that the time values are in row 1 and you want the schedule numbers
(1,2,3 and so on) on row 2.

Sub Schedule()
Dim i As Integer
Dim j As Double
Dim mStartTime As Date
Dim mIntervals As Integer

mStartTime = Range("A3").Value
mIntervals = Range("B3").Value
'Search the starting time
i = 1
Do While True
If Cells(1, i).Value = mStartTime Then Exit Do
i = i + 1
Loop
j = 0.5
While j <= mIntervals
Cells(2, i) = j * 2
j = j + 0.5
i = i + 1
Wend

End Sub

HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Sandi" wrote:

I am a scheduler and I am trying to figure out a way to count the hours of
open schedules that I have due to attrition. I have a spreadsheet with the
times of the day, in 30 minute increments, listed across the top. I am
inputting a time, say 11:00am, and a number of hours, say 4, and I would like
the macro to place a number "1" beginning at 11:00am in each box for the
alloted increments, in this case 8, since it is 4 hours. I have tried all
that I know how and I can't get it to work.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Using a macro to input data

This works but I have 2 dilemmas:

1) I would like for all of the numbers to be a "1" rather than 1 2 3 4 etc.
so I can do a count
2) I will have hundreds of entries. How do I make it show the results for
row 4 in row 4 and so on?

Thank you for your assistance.

"Pranav Vaidya" wrote:

Hi Sandi,

I think the below code will help.
I assume that the time values are in row 1 and you want the schedule numbers
(1,2,3 and so on) on row 2.

Sub Schedule()
Dim i As Integer
Dim j As Double
Dim mStartTime As Date
Dim mIntervals As Integer

mStartTime = Range("A3").Value
mIntervals = Range("B3").Value
'Search the starting time
i = 1
Do While True
If Cells(1, i).Value = mStartTime Then Exit Do
i = i + 1
Loop
j = 0.5
While j <= mIntervals
Cells(2, i) = j * 2
j = j + 0.5
i = i + 1
Wend

End Sub

HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Sandi" wrote:

I am a scheduler and I am trying to figure out a way to count the hours of
open schedules that I have due to attrition. I have a spreadsheet with the
times of the day, in 30 minute increments, listed across the top. I am
inputting a time, say 11:00am, and a number of hours, say 4, and I would like
the macro to place a number "1" beginning at 11:00am in each box for the
alloted increments, in this case 8, since it is 4 hours. I have tried all
that I know how and I can't get it to work.

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
Creating a macro for data input. Gunti Excel Discussion (Misc queries) 2 February 3rd 09 08:06 AM
Macro Data Input rbiggs Excel Discussion (Misc queries) 10 December 10th 06 11:09 PM
Data input macro Jay Oken Excel Programming 2 October 12th 05 12:22 AM
how can i input data into a pre-recorded macro Beyondjl Excel Programming 1 August 1st 05 01:41 PM
macro to input data glenn[_2_] Excel Programming 1 October 1st 03 04:59 PM


All times are GMT +1. The time now is 06:19 PM.

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"