moving cursor INTO a cell

Koen

New Member
Joined
Mar 10, 2011
Messages
18
Hello,

How can i move my cursor INTO a cell, not just make the cell active. The cursor needs to be blinking inside the cell.

so 'cells(1,1).Activate' doesn't do the thing.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi there,

What do you plan to do to the cell afterwards? Why does the cursor have to be 'blinking' inside the cell?
 
Upvote 0
Hi there, thank you for the reaction.

I'm trying to log data from over an OPC server. MyOPCItems4 is a counter value. So each time the Data changes, it is incremented. So I write 1 in A1, 2 in A2, 3 in A3, .... But the problem is, when i'm writing in a different cell, this sub isn't executed and I miss data that needs to be logged.

So I want to build something where my cursor moves out the cell where it is in at the moment the data changes. So I don't lose data.


Code:
Private Sub MyOPCGroup_DataChange(ByVal TransactionID As Long, _
                                    ByVal NumItems As Long, _
                                    ClientHandles() As Long, _
                                    ItemValues() As Variant, _
                                    Qualities() As Long, _
                                    TimeStamps() As Date)
                                   
                                    
    Dim SHandles(2) As Long 'parameter value
    Dim Values() As Variant 'return value
    Dim Errors() As Long    'return value
    Dim Qual As Variant     'return value
    Dim TS As Variant       'return value
    
 
    SHandles(1) = MyOPCItems4.ServerHandle
    SHandles(2) = MyOPCItems4.ServerHandle
    
    Call MyOPCgroup.SyncRead(OPCCache, 2, SHandles, Values, Errors, Qual, TS)
    
    Cells(MyOPCItems4, 1).Activate
              
    Cells(MyOPCItems4, 1) = Values(1)
    Cells(MyOPCItems4, 1) = Values(2)
    Cells(MyOPCItems4, 2) = TS(1)
    Cells(MyOPCItems4, 2) = TS(2)
                           
End Sub
 
Upvote 0
Hi, njimack. thankyou very much.

That's exactly what I needed, but do you also know how to make something where the cursor moves out of the cell which it is in at the moment your code is executed. Because right now it doesn't work when I'm writing in a different random cell at the moment your code is executed.

thanks.
 
Upvote 0
Hi, njimack. thankyou very much.

That's exactly what I needed, but do you also know how to make something where the cursor moves out of the cell which it is in at the moment your code is executed. Because right now it doesn't work when I'm writing in a different random cell at the moment your code is executed.

thanks.

I'm sure the cell you're writing to isn't chosen at random. Looking at your code, I guess you would need something like:
Code:
Cells(MyOPCItems4, 1).Select
 
Upvote 0
The cells 'Cells(MyOPCItems4, 1)' are the cells where the data which comes over the OPC server is writen automatically, but the operators need to add data manually (data that cant be measured, like remarks or something) in different cells.

So actually my question was wrong, I need a thing that makes my cursor move out of a random cell.

thanks
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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