• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

synchronous cursor

Kaspars

New Member
Hi,

Is there any possibility to view two cursors in excel? What I need is, if I select let's say cell D45, then somehow highlights cell D15 (to quickly see relevant data in data range), and if I move cursor to cell D46 or B45, the other one moves also to D16 or B15. Is that possibility built-in or must be made somehow?
 
Hi Kaspars,

Are you trying to highlight a data range on selection of a particular cell and another range when you select another cell?

Regards,
 
Kaspers

Can you please post a sample file

Please highlight areas you want to be made to behave like this
 
Please see uploaded file - there are two tables with identical first column. The idea is that if I select cell B21, then B8 also becomes "selected", so I can in large amount of rows find relevant corresponding data. And if I'm moving the selection just by arrow keys on keyboard, the corresponding "selection" follows.
 

Attachments

@Kaspars

Use below code, this will highlight the cell in upper table as per selection from below table.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target, Range("B17:M27")) Is Nothing Then
    r = Target.Row - 13
    c = Target.Column
    Range("B4:M14").Interior.TintAndShade = vbNull
   
  Cells(r, c).Interior.Color = vbRed
 
  Else
  Range("B4:M14").Interior.TintAndShade = vbNull
 
  End If
End Sub

The code can be generalized if you define your both tables through dynamic named range.

Regards,
 
With minimal VBA code (1 Line)

Select B4:M14
Apply a Conditional Format as a Formula using:
=AND(ROW()=CELL("Row")-13,COLUMN()=CELL("Col"))

Add 1 line of VBA code
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Range("A1").Calculate
End Sub

Enjoy
 

Attachments

Thank You both!

Hui, Your version seem simpler. But can it be stored in personal.xlsb and used in any workbook? 'cause my target file shold be macro free.
 
Nope, reloaded the file and the formatting doesn't work - so the only way is to store in the VB line in the file itself?
 
My version doesn't require VBA if you press F9 after you move
So delete the VBA
and press F9 every time you move
 
OK, this is useful if I need only few movements, but to make it automatic ('cause I need to navigate through data a lot), the only possibility is VBA, right? So I need to change the file to macro allowed file or is there a possibility to store it in personal.xlsb? Tried to save it there by creating new module, but it doesn't work.
 
Back
Top