Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy cell contents into Macro code

Using XP & Excel 2000


Trying to figure out how to enter data in worksheet cell
ex: G125 & G126; that could be used by the Macro to
establish &/or change the Loop Start & Stopping row.

Currently loop starts A128 & stops at A131

For instance might want to enter data for 10/24/03 in
only row 129.

Indented code in Macro where my attempts to tell loop
where to stop

Thanks fo any help! Bob Leonard


ROW A B C D E F G
125 START
126 END
127
128 10/17/03
129 10/24/03
130 10/31/03
131 11/10/03
132 11/17/03
133
134


Sub ForDoLoopEnterDataRight()

Dim Value As String, ows As Range

'Below is starting cell

Range("A128").Select


'Below is ending cell

MyStop = Range("A131")


'Dim varInput As String

'Range("G126").Select

'Set ows = ActiveCell

' varInput = InputBox("Enter Cell Reference")

'ActiveCell.Formula = varInput

'ows.Activate

'MyStop = varInput


' Dim Myvariable(1) As String

'Range("G126").Value = Myvariable(1)

'Myvariable(1) = MyStop


'Static MyStop As String

'Range("G126").Value = MyStop


varAnswer = MsgBox("MyStop is A131; To EDIT
Macro", vbOKOnly, "My Stop Area")

Do
For I = 1 To 5
ActiveCell.Offset(0, 1).Select

Set ows = ActiveCell

Value = InputBox("Enter Value")

ActiveCell.Formula = Value

ows.Activate


Next I
ActiveCell.Offset(0, -5).Range("A1").Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveCell.Activate

varAnswer = MsgBox(ActiveCell.Value,
vbOKOnly, "Date")

Loop Until ActiveCell = MyStop

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Copy cell contents into Macro code

suppose you have F125 with the value 128 and F126 with
the value 132

For rw = Range("F125") to Range("F126")

Vells(rw,"B").Value= _
InputBox("Enter data for " & Cells(rw, "A"), _
"Enter Value")

next


All you need to do is change the row numbers in
the 'start' and 'stop' cells ( F125 & F126)

Patrick Molloy
Microsft Excel MVP


-----Original Message-----
Using XP & Excel 2000


Trying to figure out how to enter data in worksheet cell
ex: G125 & G126; that could be used by the Macro to
establish &/or change the Loop Start & Stopping row.

Currently loop starts A128 & stops at A131

For instance might want to enter data for 10/24/03 in
only row 129.

Indented code in Macro where my attempts to tell loop
where to stop

Thanks fo any help! Bob Leonard


ROW A B C D E F G
125 START
126 END
127
128 10/17/03
129 10/24/03
130 10/31/03
131 11/10/03
132 11/17/03
133
134


Sub ForDoLoopEnterDataRight()

Dim Value As String, ows As Range

'Below is starting cell

Range("A128").Select


'Below is ending cell

MyStop = Range("A131")


'Dim varInput As String

'Range("G126").Select

'Set ows = ActiveCell

' varInput = InputBox("Enter Cell Reference")

'ActiveCell.Formula = varInput

'ows.Activate

'MyStop = varInput


' Dim Myvariable(1) As String

'Range("G126").Value = Myvariable(1)

'Myvariable(1) = MyStop


'Static MyStop As String

'Range("G126").Value = MyStop


varAnswer = MsgBox("MyStop is A131; To EDIT
Macro", vbOKOnly, "My Stop Area")

Do
For I = 1 To 5
ActiveCell.Offset(0, 1).Select

Set ows = ActiveCell

Value = InputBox("Enter Value")

ActiveCell.Formula = Value

ows.Activate


Next I
ActiveCell.Offset(0, -5).Range("A1").Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveCell.Activate

varAnswer = MsgBox(ActiveCell.Value,
vbOKOnly, "Date")

Loop Until ActiveCell = MyStop

End Sub

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy cell contents into Macro code

Pat,
I can not make sugg work! What do I have to change in my
Macro? Macro set up to goto row then enter data in cell
in Col to right of start cells; will enter data in 5
cells then return to start cell, go down one row and
enter in col's to right next set of data
Bob Leonard
-----Original Message-----
suppose you have F125 with the value 128 and F126 with
the value 132

For rw = Range("F125") to Range("F126")

Vells(rw,"B").Value= _
InputBox("Enter data for " & Cells(rw, "A"), _
"Enter Value")

next


All you need to do is change the row numbers in
the 'start' and 'stop' cells ( F125 & F126)

Patrick Molloy
Microsft Excel MVP


-----Original Message-----
Using XP & Excel 2000


Trying to figure out how to enter data in worksheet

cell
ex: G125 & G126; that could be used by the Macro to
establish &/or change the Loop Start & Stopping row.

Currently loop starts A128 & stops at A131

For instance might want to enter data for 10/24/03 in
only row 129.

Indented code in Macro where my attempts to tell loop
where to stop

Thanks fo any help! Bob Leonard


ROW A B C D E F G
125 START
126 END
127
128 10/17/03
129 10/24/03
130 10/31/03
131 11/10/03
132 11/17/03
133
134


Sub ForDoLoopEnterDataRight()

Dim Value As String, ows As Range

'Below is starting cell

Range("A128").Select


'Below is ending cell

MyStop = Range("A131")


'Dim varInput As String

'Range("G126").Select

'Set ows = ActiveCell

' varInput = InputBox("Enter Cell Reference")

'ActiveCell.Formula = varInput

'ows.Activate

'MyStop = varInput


' Dim Myvariable(1) As String

'Range("G126").Value = Myvariable(1)

'Myvariable(1) = MyStop


'Static MyStop As String

'Range("G126").Value = MyStop


varAnswer = MsgBox("MyStop is A131; To EDIT
Macro", vbOKOnly, "My Stop Area")

Do
For I = 1 To 5
ActiveCell.Offset(0, 1).Select

Set ows = ActiveCell

Value = InputBox("Enter Value")

ActiveCell.Formula = Value

ows.Activate


Next I
ActiveCell.Offset(0, -5).Range("A1").Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveCell.Activate

varAnswer = MsgBox(ActiveCell.Value,
vbOKOnly, "Date")

Loop Until ActiveCell = MyStop

End Sub

.

.

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
VBA code to copy cell contents from one sheet to another Gimp Excel Worksheet Functions 0 February 23rd 07 05:18 PM
Macro to remove contents of cell and move all other contents up one row adw223 Excel Discussion (Misc queries) 1 July 1st 05 03:57 PM
How to validate in code the contents of a cell? Heather M. Excel Programming 1 November 11th 03 08:14 AM
MACRO OR VBA CODE TO PREVENT USERS FROM PRINTING THE CONTENTS OF A WORKSHEET? Marcello do Guzman Excel Programming 1 November 8th 03 12:34 AM
run code after cell contents change Brian Excel Programming 0 September 5th 03 08:37 PM


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