#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Macro

I recently found the macro listed below. If I wanted the macro to run until
I enter XXX how would I go about that. I would want a line between each date.


Option Explicit

Private Sub Workbook_Open()

Dim vDate As String

vDate = InputBox("Please type in a date")

Worksheets("Sheet1").Range("A1") = vDate

End Sub


Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro

Option Explicit
Private Sub Workbook_Open()

Dim vDate As String
Dim DestCell As Range

Set DestCell = Worksheets("Sheet1").Range("A1")

Do
vDate = InputBox("Please type in a date")
If LCase(vDate) = LCase("xxx") Then
Exit Do
Else
DestCell = vDate
Set DestCell = DestCell.Offset(2, 0)
End If
Loop

End Sub


Cedric wrote:

I recently found the macro listed below. If I wanted the macro to run until
I enter XXX how would I go about that. I would want a line between each date.

Option Explicit

Private Sub Workbook_Open()

Dim vDate As String

vDate = InputBox("Please type in a date")

Worksheets("Sheet1").Range("A1") = vDate

End Sub

Thanks in advance


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro

The macro would drop dates in column A so fast you would be full before you ever
typed your XXX

How about two inputboxes?

One for the date and one for the number of dates down column A

Private Sub Workbook_Open()
Dim rng As Range
Dim I As Integer
Dim vDate As Date
Dim numtimes As Integer
With Sheets("Sheet1")
vDate = InputBox("Please type in a date")
numtimes = InputBox("How far to increment? Enter a number")
Set rng = Range("A1")
rng.Value = vDate
For I = 1 To numtimes Step 1
rng.Offset(I, 0).Value = rng.Offset(I - 1, 0).Value + 1
Next I
End With
End Sub


Gord Dibben MS Excel MVP

On Mon, 10 Mar 2008 12:18:00 -0700, Cedric
wrote:

I recently found the macro listed below. If I wanted the macro to run until
I enter XXX how would I go about that. I would want a line between each date.


Option Explicit

Private Sub Workbook_Open()

Dim vDate As String

vDate = InputBox("Please type in a date")

Worksheets("Sheet1").Range("A1") = vDate

End Sub


Thanks in advance


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
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM


All times are GMT +1. The time now is 04:26 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"