VBA script to enter values rows

llikethat

New Member
Joined
Sep 8, 2020
Messages
3
Office Version
  1. 2010
Platform
  1. Windows
Hi All,

I have the following query

Cell Sheet1!(A1) has value that changes every 2 seconds. I want to store this cell data in Sheet2!(A:A) as and when the Sheet1!(A1) value changes. For example

Sheet2!(A1)=10
Sheet2!(A2)=14
Sheet2!(A3)=45
Sheet2!(A4)=32
...
...
...
...

In the above example, 10,14,45,32 are values from Sheet1!(A1) which was appearing in that cell every 2 seconds.

Thanks
Bharani
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Paste this in the Sheet1 Module :

VBA Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Sheets("Sheet2")
        .Range("A" & Rows.Count).End(xlUp).Offset(1).Value = Me.Range("A1").Value
    End With
    Me.Range("A1").Value = ""
End Sub
 
Upvote 0
How exactly are the values in cell A1 on Sheet1 being updated?
Is it a formula or a link to somewhere else?
If so, what is it?
 
Upvote 0
Paste this in the Sheet1 Module :

VBA Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Sheets("Sheet2")
        .Range("A" & Rows.Count).End(xlUp).Offset(1).Value = Me.Range("A1").Value
    End With
    Me.Range("A1").Value = ""
End Sub

Thanks for the quick reply. Will try this out.
 
Upvote 0
How exactly are the values in cell A1 on Sheet1 being updated?
Is it a formula or a link to somewhere else?
If so, what is it?

The values are taken from an external data link and that data updates periodically. It's like network data.

Thank you.
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,790
Members
448,994
Latest member
rohitsomani

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