Hello Everyone
I am a complete novice at VBA having only picked it up a day or two ago with no previous programming experience. Here's my problem if anyone out here is able to help:
I have created an excel document that can be used to populate a table on one of the worksheets (Switching Sequence) using a number of different drop down boxes. The choices made on the drop down boxes are shown in another table on another worksheet (Populated Table). This table on "Populated Table" needs to be copied and pasted into an existing template where it can be saved and printed off for use.
The table consists of the following rows:
Operation Number (column B) , Location (column C), Circuit or Device (column D), Operation (column E), Complete? (column F), Date and Time (column G)
Is there a way in which my code is able to copy the table (range B5:G82) and then only past the rows in which there is an Operation in its corresponding D cell?
Here is what I have already. So far it copies and pastes the whole range (B5:G82) but I am unable to make it ignore the rows with a blank in it's corresponding D column.
Sub CopyToWord()
Dim wd
Dim Data As Range
Dim Doc
Set Data = Sheets("Populated Table").Range("B5:G82")
Data.Copy
Set wd = CreateObject("Word.Application")
wd.Visible = True
Set Doc = wd.Documents.Add(Template:="C:\Users\user\Documents\Work\Switching Program\test2.docx")
wd.Selection.Paste
Application.CutCopyMode = False
End Sub
I will attach my excel sheet so if anyone has chance they can have a proper look at it.
So in summary I want to be able to:
1. Populate table in Excel
2. Copy table
3. Paste table in word template but without the rows with a blank cell in its D column
Any help would be amazing
Many thanks
AM2809
Bookmarks