Copy Value from new Workbook to existing Workbook
Closed
classermild
Posts
1
Registration date
Friday September 14, 2018
Status
Member
Last seen
September 14, 2018
-
Sep 14, 2018 at 03:14 AM
Blocked Profile - Sep 14, 2018 at 05:11 PM
Blocked Profile - Sep 14, 2018 at 05:11 PM
Related:
- Copy Value from new Workbook to existing Workbook
- Apply snapchat filter to existing video - Guide
- Run macro on opening workbook - Guide
- Excel vba check if value exists in list - Guide
- Copy data from one workbook to another vba - Guide
- Excel vba add sheet to another workbook - Guide
1 response
Yes, this is possible.
Below are some code examples. Cut and paste what you need and make your own routine.
Below are some code examples. Cut and paste what you need and make your own routine.
Function sheetexist(whatsheet)
On Error GoTo NotExists
ThisWorkbook.Worksheets(whatsheet).Select
sheetexist = True
Exit Function
NotExists:
sheetexist = False
End Function
Function testsheet(whichsheet, rowNum)
nret = sheetexist(whichsheet)
If nret = False Then makesheet (whichsheet)
nret = copyrowX(whichsheet, rowNum)
End Function
Sub makesheet(whatsheet)
On Error GoTo ExitSub
With ThisWorkbook
.Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = whatsheet
End With
ExitSub:
End Sub
Function copyrowX(towhatsheet, whatrow)
ThisWorkbook.Worksheets("Sheet1").Select
ThisWorkbook.Worksheets("Sheet1").Range("A" & whatrow).EntireRow.Select
Selection.Copy
ThisWorkbook.Worksheets(towhatsheet).Select
cellcount = Cells(ThisWorkbook.Worksheets(towhatsheet).Rows.Count, 1).End(xlUp).Row
ThisWorkbook.Worksheets(towhatsheet).Range("A" & cellcount).EntireRow.Select
Selection.Insert
End Function
Sub ReadSheet()
cellcount = Cells(ThisWorkbook.Worksheets("Sheet1").Rows.Count, 1).End(xlUp).Row
For RowCount = 1 To cellcount
cellvalue = ThisWorkbook.Worksheets("Sheet1").Range("A" & RowCount).Value
nret = testsheet(cellvalue, RowCount)
ThisWorkbook.Worksheets("Sheet1").Select
Next
End Sub