LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default InputBox and For...Next Loop

I have a simple macro which asks a user for two dates. The dates are input
into the sheet and thats that. Pretty simple, really.

Option Explicit
Sub InputDates()
Dim xdate As Date
Dim ydate As Date
Range("B1") = ""
Range("B2") = ""

xdate = InputBox("Beginning Date?", "Beginning Date", vbOKCancel)
Sheets("Sheet1").Range("B1") = ydate
ydate = InputBox("End Date?", "End Date", vbOKCancel)
Sheets("Sheet1").Range("B2") = ydate

maybe something like this:
n = ydate - ydate
For i = 1 to n
..Range("A5") = .Range(A4).Offset(1, 0)
Next n

End Sub

First, I keep getting a subscript out of range error on this line:
Sheets("Sheet1").Range("B1") = xdate
It worked several times, then stopped working all of a sudden. Also, I just
added the fornext loop as pseudo code; Im not really sure how to set it up.

Also, I have a function in A4 which gives me the beginning date:
=B1

Also, I have many, many, many functions, starting in A5, and going down:
=IF(A4<$B$2,A4+1,"")


I am looking for a way to simplify this with a macro, so that the macro just
lists each date in Column A, and just goes down the whole date range. For
instance, if the beginning date was 1/1/2008 and the ending date was
12/30/2008, 365 rows would get filled with a day of the year in each.
Finally, starting in B4, I wanted to do a simple calculation, such as this:
=1-CHIDIST(A3,B3)

Basically, this is for a one-tailed probability of the chi-squared
distribution, measured over time.

Id sincerely appreciate any input.

Regards,
Ryan--




--
RyGuy
 
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
Do Until Inputbox = loop count ewan7279 Excel Programming 10 November 9th 07 03:06 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
inputbox loop dodo Excel Programming 1 June 30th 05 02:42 PM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM


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

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

About Us

"It's about Microsoft Excel"