I'm looking to take some data from Excel and paste it to Word as tables. So, with this Excel data there would end up being six separate tables in Word.
I've been working with a couple of threads with a possible solution, but just not getting the syntax right. This will just be written to a new word doc.
If found the following code and also the code from this most recent
post.
This of course works great, but now to loop thru the ranges.
Code:
Sub Demo()
Dim wdApp As New Word.Application
Dim wdDoc As Word.Document
ActiveSheet.Range("A2").Resize(4, 2).Copy
With wdApp
.Visible = True
Set wdDoc = .Documents.Add
With wdDoc
.Range.PasteExcelTable False, False, True
End With
End With
Set wdDoc = Nothing: Set wdApp = Nothing
Application.CutCopyMode = False
End Sub
Here is the code to loop thru the ranges, just not sure on how to combine the two.
Code:
Sub LoopthruRange()
Dim Rng As Range
With Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlConstants)
For Each Rng In .Areas
Rng.Resize(, 2).Copy
Next Rng
End With
End Sub