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: 61
Default Loop help

Hi
I am new to VBA and am trying to learn by disecting existing code and
appying to my projects. Part of the code that I have written so far is:

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet

Set ws = Worksheets("Data")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

Some Code

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.tx1t.Value
ws.Cells(iRow, 2).Value = Me.txt2.Value
ws.Cells(iRow, 3).Value = Me.txtStart.Value
ws.Cells(iRow, Me.txtStart.Value + 5).Value = Me.txt3.Value

'clear the data
Me.txt1.Value = ""
Me.txt2.Value = ""
Me.txtStart.Value = ""
Me.txt3.Value = ""

End Sub

This copies the txt3 value to the correct cell. What I would like to do is
add a txtStop and have the code loop through and copy to all of the cells in
irow in the columns from txtStart +5 to txtStop+5.
Thanks
 
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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
How do I create a For loop within a For loop? Linking to specific cells in pivot table Excel Programming 2 January 24th 05 08:05 AM
For/Loop skipping one value in loop only Matt Jensen Excel Programming 6 January 8th 05 12:03 PM
Worksheet_Change - loop within a loop bgm Excel Programming 1 January 19th 04 01:27 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


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