I have the following code that when run starts at row 1 instead of 84. For the life of me I cannot figure out why this is so.
Sub modulenter()
Dim appWD As Word.Application
Dim Name As String
Set appWD = CreateObject("Word.Application")
appWD.Visible = False
Sheets("Sheet1 (3)").Select
lastrow = Range("F9999").End(xlUp).Row
For i = 84 To lastrow
j = Sheets("MasterList").Cells(Rows.Count, 4).End(xlUp).Row
Sheets("MasterList").Cells(j + 1, 1).Value = Sheets("Sheet1 (3)").Cells(i, 3).Value
Sheets("MasterList").Cells(j + 1, 2).Value = Sheets("Sheet1 (3)").Cells(i, 4).Value
Sheets("MasterList").Cells(j + 1, 3).Value = Sheets("Sheet1 (3)").Cells(i, 5).Value
Next i
End Sub
The odd things is, when I run my entire macro, it starts at row 84 and stops right there. It doesn't move on to the next row. So I'm stuck with only 1 miserly entry. My full code is as follows:
Sub modulenter()
Dim appWD As Word.Application
Dim Name As String
Set appWD = CreateObject("Word.Application")
appWD.Visible = False
Sheets("Sheet1 (3)").Select
lastrow = Range("F9999").End(xlUp).Row
For i = 84 To lastrow
j = Sheets("MasterList").Cells(Rows.Count, 4).End(xlUp).Row
Sheets("MasterList").Cells(j + 1, 1).Value = Sheets("Sheet1 (3)").Cells(i, 3).Value
Sheets("MasterList").Cells(j + 1, 2).Value = Sheets("Sheet1 (3)").Cells(i, 4).Value
Sheets("MasterList").Cells(j + 1, 3).Value = Sheets("Sheet1 (3)").Cells(i, 5).Value
Sheets("Sheet1 (3)").Select
Cells(i, 6).Copy
' Tell Word to create a new document
appWD.Documents.Add
' Tell Word to paste the contents of the clipboard into the new document
appWD.Selection.Paste
' Save the new document with a sequential file name
appWD.Selection.Find.Replacement.ClearFormatting
With appWD.Selection.Find
.Text = "@"
.Replacement.Text = "^n"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
appWD.Selection.Find.Execute Replace:=wdReplaceAll
appWD.Selection.WholeStory
appWD.Selection.Cut
Sheets("Masterlist").Select
Range("D" & j + 1).Select
ActiveSheet.PasteSpecial _
Format:="Text", Link:=False, DisplayAsIcon:=False
Application.Run "deleterow"
appWD.ActiveDocument.SaveAs Filename:="Doc_" & i
appWD.ActiveDocument.Close
Next i
' Close the Word application
appWD.Quit
End Sub
Anybody have any ideas?
Bookmarks