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: 34
Default Hmmm, Where do I begin???

Ok well my goal is to start out by using the DateAdd function to add
the number of months in column F to Colum H and comare it to Column I.
If that date is < the Date in Column I, then copy the data K of the
corresponding Row and paste Starting in colum M of the same row. If
that date is than the date in Column I, a zero is placed in that
cell. Repeat this step all the way to Colum AC. These steps are then
repeated on the next row, and the next and so forth until the program
arrives at cell M64. My current error is "Loop without Do" This is not
the case as all DOs have a corresponding Lopp. Please Help. My Code is
as follows:

Dim PayRange As Range
Dim TestRange1, TestRange2, TestRange3 As Range
Dim TestDate As Date
Dim CurrentColumn As Column

Dim RowNumber As Integer

Range("M7").Select

Do While ActiveCell < Range("M64")

RowNumber = ActiveCell.Row
'MsgBox RowNumber
TestRange1 = "F" & RowNumber
TestRange2 = "H" & RowNumber
TestRange3 = "I" & RowNumber
PayRange = "K" & RowNumber


TestDate = DateAdd("m", Range("TestRange1").Value,
Range("TestRange2").Value)

If TestDate < Range("TestRange3").Value Then

Call ChoosePasteColumn

Else:
ActiveCell.Offset(0, 2).Select
If ActiveCell.IsEmpty = True Then
ActiveCell.Value = 0
Else

Do Until IsEmpty(ActiveCell.Value)
ActiveCell.Offset(0, 1).Select
Loop
ActiveCell.Value = 0

End If

If CurrentColumn = "AD" Then
ActiveCell.Offset(1, 17).Select

ElseIf CurrentColumn = "AC" Then
ActiveCell.Offset(1, 16).Select
End If
Loop

End Sub

Function ChoosePasteColumn()

Dim RowNumber As Integer
Dim PayRange As Range

RowNumber = ActiveCell.Row
PayRange = "K" & RowNumber

ActiveCell.Offset(0, 2).Select
Do While ActiveCell.Column < Range("AD:AD")

Do While ActiveCell.Value = Empty

Range("PayRange").Select
Selection.Copy
ActiveSheet.Paste
ActiveCell.Offset(0, 1).Select

Loop

Loop
End Function

 
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
Can't Copy and Paste when I'm using a filter List.. hmmm Benjamin Excel Discussion (Misc queries) 1 September 22nd 09 05:13 PM
Hmmm, where do I begin? loren.pottinger Excel Discussion (Misc queries) 2 August 30th 06 07:22 PM
Hmmm bonzai18 Excel Programming 3 March 16th 06 02:01 AM
compute? hmmm. ohmygosh Excel Discussion (Misc queries) 1 November 16th 05 12:39 PM
Can't stop Excel re-calculating on opening - hmmm... gearoi[_2_] Excel Programming 1 August 25th 05 04:55 PM


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