excel copy/paste cell to cell using address in another cell - excel

How to Copy/Paste a value from 1 cell to 2nd Cell using a 3rd Cell which holds the address of the 2nd Cell. I want to trigger the copy/past action by a 4th Cell going 'true'. I do not want to use VB as I am not competent with it.

You will need to use VBA I think. The only way to get a cell to show a value other than by programming is to enter a formula into your 2nd cell - but by definition you don't know what that is. Assume that A1 holds the value to copy, A3 is the cell holding the cell address and A4 is the true/false cell. Then you need this code in the module page of the sheet you wish to affect:
Private Sub Worksheet_Calculate()
If range("a4") then
range(range("a3").text).value = range("a1").value
End If
End Sub
Note this will error if A3 doesn't hold a valid cell address

Related

Change a Variable Cell using a VBA however I would like to change another cell and this second cell change de first one

To be more specific, my code is:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("B10").GOALSEEK Goal:=Range("B11").Value, ChangingCell:=Range("B33")
End Sub
In this case when I set a value in the cell B33, the result in the cell B37 is changed due to keep B10 equal B11 however I would like to know if it is possible to change the value in the cell B37 changing B33 and vice versa keeping B10 equal B11.

Record Changing Cell Value in Excel

I have a cell whose value is constantly changing through a feed. I want to develop a macro which when activated records the cell value at that instant and pastes it in another cell. Tried finding some formula to do that but no success.
You won't be able to do that with a formula. However, you can write a macro that checks if your cell was changed:
Private Sub Worksheet_Change(ByVal Target As Range)
...
End Sub
If you don't want this type of automation, you could simply add a button to your worksheet which triggers a macro when clicked and does what you are looking for.
To copy the value of a cell into another one, you could use this simple solution:
Range("B1").Value = Range("A1").Value
This will copy the value of cell A1 into cell B1.

Is it possible to extract cell reference from a hyperlink?

I've been researching this one for a while now with no luck, so thought I would open it up here...
Let's say you have two worksheets in an excel workbook, e.g. sheet1 and sheet2.
Now, in sheet2 cell A1, say you have a hyperlink that refers/points/links to sheet1 cell A1. In other words, the value of the cell reference of the hyperlink at sheet2!A1 is sheet1!A1
Do you know if there is a formula or function that would return the cell reference of that hyperlink.
i.e.
=<formula-or-function>(sheet2!A1)
which returns 'sheet1!A1' as its result.
You can retrieve the .SubAddress from the Hyperlinks.Item Property.
'by the active cell
With ActiveCell
Debug.Print .Hyperlinks.Item(1).SubAddress
End With
'by worksheet and cell address
With Worksheets("Sheet2").Range("D6")
Debug.Print .Hyperlinks.Item(1).SubAddress
End With
This is, of course, VBA. I know of no way to perform this action with a worksheet formula short of a User Defined Function (aka UDF) written in VBA.

Excel formula not executing on run time with selecting and double click on the particular cell

My scenario is , I have one Excel sheet. On the same sheet in cell A2 I am inserting the data through code and cell B2 I already put the data manually before inserting the data in cell A2, in cell C2 I written the formula =EXACT(A2,B2).
Now when I run the code, the code put the value in cell A2,and the Status should be change according to the condition given and the data on both cells. But it doesn't change the status according to the formula in cell C2 and the status gets changed when I double click on that particular cell and enter then the condition work. Please tell me how it will be possible without double click on the particular cell?
This works (I've tested it) if automatic calculation is switched on (Excel Options->Formulas->Calculation Options).
Here's the code (I'm using A1, B1, C1):
Private Sub CommandButton1_Click()
Cells(1, 1).Value = 2
End Sub

How can I reference a cell from a different cell

How can I reference a cell from a different cell?
For eg:
I want to reference Cell A1 = B1, But dont want any formulas/logic in Cell A1. The formula/logic can be in any other cell.
How can I do this?
If you want to change a cell value without having a formula in the same cell, you'll likely need to use VBA. For example:
At Wrox Programmer-to-Programmer, Maccas posts the following example:
Sub UpdateVal()
ActiveSheet.Range("A5").Value = ActiveSheet.Range("B5").Value
End Sub
One question that comes to mind however, is why you don't want a formula in cell A1?
Something like =IF(some_condition, B1, "") would leave cell A1 blank unless it met some condition, but populate it with B1's value otherwise.

Resources