Gautam489
11-23-2020, 12:38 AM
Help Please,
Hello there. i am trying to copy columns a,k,l and m column, if there is data in column m, with following code, however i cant do as t copy whole column from a to m.
Code is
Sub ExcelWord()
Dim wdApp As Object
Dim wd As Object
Dim c As Range
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
Set Source = ActiveWorkbook.Worksheets("Sheet1")
If Err.Number <> 0 Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wd = wdApp.Documents.Add
wdApp.Visible = True
For Each c In Source.Range("m4:m1000") ' Do 1000 rows
If c > 1 Then
Source.Range(Cells(c.Row, 1), Cells(c.Row, 14)).Copy
wdApp.Selection.PasteExcelTable False, False, False
End If
Next c
End Sub
Hello there. i am trying to copy columns a,k,l and m column, if there is data in column m, with following code, however i cant do as t copy whole column from a to m.
Code is
Sub ExcelWord()
Dim wdApp As Object
Dim wd As Object
Dim c As Range
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
Set Source = ActiveWorkbook.Worksheets("Sheet1")
If Err.Number <> 0 Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wd = wdApp.Documents.Add
wdApp.Visible = True
For Each c In Source.Range("m4:m1000") ' Do 1000 rows
If c > 1 Then
Source.Range(Cells(c.Row, 1), Cells(c.Row, 14)).Copy
wdApp.Selection.PasteExcelTable False, False, False
End If
Next c
End Sub