To copy one cell to another is very easy, you just have to make a reference to the cell you want to copy.
Copy cell value to another cell
For example, to copy cell A2 to C2, enter =A2 in C2.
Copy cell value from another sheet
You can also do it with the value that is present on another sheet.
Copy and paste the specific value to different cell
This VBA function will work in the following way.
The following function will check whether a cell contains text, numerical value, error, or formula.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Function CopyCell(ByVal target As Range, cellType As String) If target.HasFormula And cellType = "formula" And Not IsError(target.Value) Then CopyCell = target ElseIf Application.IsText(target.Value) And cellType = "string" Then CopyCell = target ElseIf IsNumeric(target.Value) And cellType = "number" Then CopyCell = target ElseIf IsError(target.Value) And cellType = "error" Then CopyCell = target Else CopyCell = "" End If End Function |
The function checks a few conditions and if a condition is met it copies the cell, otherwise it places a blank cell.
The function has a few modifications. For example, under formulas, I added a condition, that it won’t display errors (which are also formulas).
You might also consider not copying the value in cell E4 because it’s formatted as text.
Enter the following formulas into cells:
C2: =CopyCell(A2,”formula”)
D2: =CopyCell(A2,”string”)
E2: =CopyCell(A2,”number”)
F2: =CopyCell(A2,”error”)
Press Ctrl + ~ to display formulas.