Many Excel users struggle when trying to figure out how to move data from an entry sheet onto an archived sheet. Although Excel is a spreadsheet designed to perform complex calculations, such as mortgage amortization tables or tracking sales figures, most people never explore its more in-depth operations. This FAQ will walk you through how to qualify and move your data.
Copying Data from One Excel Sheet to Another with a Formula
Begin by opening up the developer tab in Excel. Next, you need to construct the Sheet Controller UserForm. This UserForm allows you to select where the data is moved from, where the data is moved to, what column to inspect for the qualifying data to determine if it moves, and what the value of the column entry should be to move it.
When creating your UserForm, copy the following example, taking care to name each control correctly:
Attaching Code to Each Control
Now that you have constructed the Userform, you need to attach code to each control. In the UserForm, double-click the control named CommandButton2. The diagram of the Userform should no longer be visible, and you should now be presented with the code explorer, with the default code block. This particular code block starts with Private Sub ComandButton2_Click(). Place your cursor under the first line, but before the line that says End Sub. Now, enter the following code to set up the public variables to be applied to the rest of the code:
Now, go back to the UserForm Explorer, and double-click the control marked CommandButton3. Once again, the UserForm gets put aside for the code explorer. Place your cursor on the newly created code block, and enter the following code:
In the Explorer section of the Project Explorer, right-click Microsoft Excel Objects. Select Insert > Module.
Double-click the module called Module1, and type in the following public variables:
Now, go ahead and insert three more sheets into your workbook. You should now have four sheets, named Sheet1, Sheet2, Sheet3, and Sheet4.
On Sheet1, place items into about 10-15 lines, using the below image as an example of the test data:
Next, in the Developer tab (on top of the workbook), click Controls > Insert > the button icon:
Now, place the button anywhere on your sheet. When it asks about macros, select New.
You will notice that it placed the new macro in Module2 of the project. Highlight the code block in Module2, cut it from Module2. Now, double-click Module1. When the Code Explorer opens, right-click and select Paste. You should, now, have an empty code block that reads:
Place your cursor inside of the code block, and add the following code:
You will notice that there is a function called Buildform. This sets up the UserForm for the appropriate number of sheets, after taking inventory of them. To apply this, place the following code into the Code Explorer, below the Button1_Click() subroutine:
Within the buildform function, there is another function called Counttabs. You should place this code above the Buildform code, but below the Button1_click subroutine:
If both the TabFrom and TabTo variables are set, you will, then, need to run the createNew() function. Place the below code into the Code Explorer, above the Button1_click subroutines:
If you have chosen to create a new sheet, change the TabTo variable to the new sheet name. You will then need to run the LoopForMove(TabFrom, TabTo) routine. In the Code Explorer, enter the following code:
To find the last row of your sheet, enter the below code into the Code Explorer, above LoopForMove(FromWhatSheet, ToWhatSheet):
Now, you will be able to move the actual code using the Moveit(FromWhatSheet, CellLoc, ToWhatSheet, CutVal) function. Between the LooForMove() and createNew() functions, place the following code:
Continue to loop through each line on the From sheet, looking for qualified entries, using a For Loop function.
To sum up the actions of a UserForm, see the following illustration:
Here is the same illustration with, this time, with more elements taken into consideration:
Finally, here is the aforementioned code in its entirety:
Public Qualif As String
FindLastRow = Cells(ThisWorkbook.Worksheets(OnWhatsheet).Rows.Count, 1).End(xlUp).Row
Function LoopForMove(FromWhatSheet, ToWhatSheet)
Dim LastRow, Cnt
Dim CellValue As String
If WhatCol = "" Then
WhatCol = "A"
If Qualif = "" Then
Qualif = "X"
LastRow = FindLastRow(FromWhatSheet)
For Cnt = LastRow To 1 Step -1
CellLoc = WhatCol & Cnt
CellValue = ThisWorkbook.Worksheets(FromWhatSheet).Range(CellLoc).Value
If CellValue = Qualif Then
nret = Moveit(FromWhatSheet, CellLoc, ToWhatSheet, CutVal)
Function Moveit(FromSheet, WhatRange, ToWhere, CutVal)
If CutVal = True Then
MoveSheetLastRow = FindLastRow(ToWhere)
ThisWorkbook.Worksheets(ToWhere).Cells(MoveSheetLastRow + 1, 1).EntireRow.Select
Application.CutCopyMode = False
If TabTo = "New Sheet" Then
NewSheet = ThisWorkbook.ActiveSheet.Name
TabTo = NewSheet
If FormXcel = False Then
If TabFrom <> "" And TabTo <> "" Then
nret = LoopForMove(TabFrom, TabTo)
MsgBox ("Please set a 'From' and a 'To' sheet!")
Counttabs = ThisWorkbook.Worksheets.Count
Controller.ComboBox2.AddItem "New Sheet"
For TabCount = 1 To Counttabs
- How to copy data from one sheet to another in excel using formula
- How to copy cells from one sheet to another in excel using formula - Best answers
- How to copy from one excel sheet to another with formula - Best answers
- Transfer Data Between Excel Spreadsheets - How-To - Excel
- Copying data from one Excel sheet to another. ✓ - Forum - Excel
- How to transfer data from one sheet to another in excel using formula - How-To - Excel
- Automatically transfer data from one sheet to another in excel - How-To - Excel
- How to copy data from one sheet to another in excel automatically ✓ - Forum - Excel