Copy value in Column A with thousands row o another sheet

Mr Sin

New Member
Joined
Sep 9, 2014
Messages
4
I am working with a working one, which has a ID column. I need to copy repeatedly copy single column value to another sheet. For example, Copy Sheet1 A2 to Sheet2 A2, then "End For" to run other macro code and loop this process again; Copy Sheet1 A3 to Sheet2 A2 then run; Copy Sheet1 A4 to Sheet 2 A2 then run other macro.......so and so..
it contain thousand row. is there any vba code could help on this problem.

Thanks in advance.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Sub CopyFilterResult()
' This loop repeats for generate multiple word documents by ID
' in the range
Dim objWordApp As Word.Application
Dim objWord As Word.Document
Dim i As Long
On Error GoTo errHandle
Set objWordApp = New Word.Application
Set objWord = objWordApp.Documents.Add
objWord.Application.Visible = True
Sheets("Sheet4").Select
Cells.Select
Selection.Clear
Sheets("Target").Select
Range("A2").Select
Selection.Clear
With Worksheets("id")
lastcell = Range("A" & Cells.Rows.Count).End(xlUp).Row
For i = 0 To lastcell
.Range("A1").Offset(1, 0).Copy Sheets("Target").Range("A2")
Next i
End With
Worksheets("Sheet1").Range("A1").CurrentRegion.AdvancedFilter _
Action:=xlFilterCopy, CriteriaRange:=Worksheets("Target").Range("A1:A2").SpecialCells(xlCellTypeVisible), _
CopyToRange:=Worksheets("Sheet4").Range("A1"), Unique:=True
With Worksheets("Sheet4")
Set rngCopy = .Range("A1:D" & .Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeVisible)
End With
With objWord.Application
.Selection.Style = .ActiveDocument.Styles("Normal")
.Selection.TypeParagraph
rngCopy.Copy
.Selection.PasteExcelTable False, False, False
End With
objWord.SaveAs
FPath = "desktop"
FName = Worksheets("Sheet4").Range("A2").Value
ActiveDocument.SaveAs Filename:=FPath & "\" & FName, _
FileFormat:=wdFormatDocument
objWord.Close
objWordApp.Quit
errExit:
Set objSel = Nothing
Set objWord = Nothing
Set objWordApp = Nothing
Exit Sub
errHandle:
MsgBox Err.Description
Resume errExit
End Sub
_______________________________________________________
Here is my code
dont know whether what loop i can use, in order to generate two word document at the same time.Thanks for your reply!!!
 
Upvote 0

Forum statistics

Threads
1,215,020
Messages
6,122,712
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top