Free Microsoft Excel 2013 Quick Reference

Moving the cursor position

Hi All,

I am fairly new to programming Excel, and when I do itis either through C++
or C# so my terminoligy may not be correct but this is what I want to do.

I have to populate several spreadsheets in a workbook from a SQLServer
database using ADO, which I do without any problems.

After I have finished populating each sheet I want to move back to cell A1
and then move on to the next sheet.

The theory is that when I save the book and re-open it I will see cell A1
on each sheet. Currently I am on cell AB445, or some such number.

My question is how do move back to cell A1 after opulating the sheet. I
will need to know what object the method belongs to, i.e. Workbook,
Worksheet, Range etc.

TIA
Peter


Post your answer or comment

comments powered by Disqus
I would like to be able to set the position of the cursor in the text in a particular cell using VBA.

The situation is that I am creating a lab report writer. Using then worksheet_selection_event I can determine where on the page the user clicked (by making the columns quite narrow), and bring the text for that row (which resides in the 1st cell of the row) to the formula bar for editing. I would like to be able to move the cursor along in the formula bar to the correct place in the text (or close to it) based on where on the screen they clicked in order to edit the line.

Can anyone tell me the code for doing this?

Thanks

I like to know if this is possible.
I have a worksheet that in which there are a few cells entry of data is needed. What I want to do is after the data is entered move the cursor to the need position where data entry is needed. For example A1 move to D1 then move to E5 then loop back to A1.

Hi all,

I have been having this issue a couple of times and I've asked to anyone I think might know the anwser to my problem, but unfortunately, I have not received any right answer yet.

Here is my problem. Sometimes when working on Excel (no matter the version) I press, click or type something or some command that does not allow me to move the cursor by cells with the arrows on the key board. Instead of moving cell by cell, when using the arrows on the keyboard, it will scroll the entire screen.

Does any of you have had the same problem ever?

Any solutions to that?

Any help will be greatly appreciated.

Thanks in advance.

Jesus C.

If I click on a cell and move the cursor the entire area begins to highlight
and I cannot control the cursor or what is activated. I need to do ctrl Alt
DEL to get and start again. Have you had that happen? Who would I go to see
what the problem is?

If I click on a cell and move the cursor the entire area begins to highlight
and I cannot control the cursor or what is activated. I need to do ctrl Alt
DEL to get and start again. Has anyone had that happen? How do we get out of
this problem other than ALT CNTRL DEL, or using the task manager?

Is there a way to include, as part of a macro, an instruction that will move THE CURSOR to another cell?
I don’t mean going to a cell by selecting it, but, while one cell is selected, moving just the cursor to any other spot without selecting this (as we would do manually with the mouse).
Thanks for any help

Hi,
I want to write a VBA code and want to move my cursor down to a visible cell on a filtered data. I have tried the following command
ActiveCell.Offset(1, 0).Select
but it moves the cursor to next unfiltered cell instead of my desired cell.

Kindly kelp me out

Hi,

I have the command button which is placed in excel to open the SaveAs Dialogbox.

When i click command button, The cursor will automatically moving to File menu and do click on it then the dropdown will come. And again cursor will moving to SaveAs option and do click on it.

Can you please help me to do this.

Thanks You

I currently use the following to change my cursor position:

	VB:
	
 SetCursorPos Lib "user32" _ 
(ByVal x As Long, ByVal y As Long) As Long 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
I was wondering if there is a way so the cursor will set its position relative to the active window.

So if x=200 and y=300, instead of moving the cursor to 200 pixels from the upper left corner of the screen and 300 pixels down, it would move 200 pixels to the left and 300 down from the upper left corner of the active window.

Alternatively, I could write something that does this myself if there is a method that get the location and maybe size of the active window (or better yet an open window of my choice).

Is there a way to highlight ( in a color ) the cells as you move the cursor around in Excel? For instance, if you are in one cell, it would be in a color that you pick. When you move the cursor up, down, left, or right, the cell that you go to would then turn that color

Is there a function that I could place in cell A1 that will return
information on whatever cell is selected in on the spreadsheet? So for
instance, if the current cursor position is in cell D3, I would like cell A1
to display "D3". And if I move the cursor to cell E5, I would like cell A1
to display "E5"

Hello from Steved

If I type in any cell in Col D 40043 the moment it types in the last numeral
in this case 3 the cursor goes across two tabs to the right to Col F.

In every case it types 5 numerals on the last numeral the cursor then moves
2 cells to the right.

Thankyou.

Is there a function that I could place in cell A1 that will return
information on whatever cell is selected in on the spreadsheet? So for
instance, if the current cursor position is in cell D3, I would like cell A1
to display "D3". And if I move the cursor to cell E5, I would like cell A1
to display "E5"

Hi,

I have a macro:

'Item
If Target.Address = ("$E$6") Then
Range("E8").Select
ElseIf Target.Column = 5 And Target.Row = 6 Then
Range("E8").Select
End If
Which is repeated in a sheet several times so that when data is entered in various cells the cursor automatically moves to the next relevant box.
It works fine.

However, it only works when data is actually entered. If I just hit enter, it doesn't work and I'd like it to.

Any ideas?

Hello there,

is it possible, and if so, how, to show X- and Y-coordinates
of the cursor position in a range / cell while mouse moves ?

Thank you in advance,

Regards,

RR

When I make a large selection, e.g. ^*, I often want to move the selected cell from 1 corner to anoter in order to add rows or columns. In previous versions of Excel there was a keyboard shortcut for moving the cursor position to different corners of the selection. Is there a keyboard shortcut for that in Excel 2007?

Chuck

is there vba code to simulate the action of moving the mouse cursor and left click/right click of the mouse?

thanks a lot

Is there a way when entering data in a spreadsheet - to have the cursor move
to column A after entering data in Column F or beyond?

Hi all...first time post.

Can anyone tell me where Excel 2003's "Tools > Options > Edit > Move selection after Enter" command is in Excel 2007 please?

It allowed you to dictate the cursor movement after entering data in a cell.

Excel 2007 currently moves the cursor down to the cell below. I want it to stay in the cell I've just entered the data into.

Thanks in advance.

A simple problem turning my hair greyer! I want to have the cursor move to different locations depending on a number I put in a common cell. ie if A1 is 10 move cursor to G2, if A1 is 15 move cursor to P22
Cheers

Hello everyone!

I have a userform with a textbox and a commandbutton. I would like to insert a character--say a bullet or a checkmark, for example--when the commandbutton is pressed after the cursor position in the textbox, which may be in the middle of a paragraph.

userform_issue.jpg

The Userform Code:


	VB:
	
 clsFormChanger 
Private Sub CB_Discard_Click() 
    Unload Me 
End Sub 
Private Sub cmdSave_Click() 
    apeRng.Value = Replace(Replace(ActionPlan.TextBox1.Value, Chr(13), ""), Chr(9), "     ") 
    Unload Me 
    Set apeRng = Nothing 
End Sub 
Private Sub CommandButton1_Click() 
End Sub 
Private Sub CommandButton3_Click() 
End Sub 
Private Sub Label1_Click() 
End Sub 
Private Sub ResizeForm() 
    With Me 
         '.StartUpPosition = 0
         
         'this is not essential as the form can obviously be sized at design time
         'but some of the objects become invisible after resizing so this allows
         'those objects to remain visible in design mode
         'also removing the title bar requires the form to be partially resized anyway
        .Width = 244 
        .Height = 202 
    End With 
End Sub 'ResizeForm
Private Sub TextBox1_Change() 
End Sub 
Private Sub UserForm_Initialize() 
    Set mclsFormChanger = New clsFormChanger 
     
    Set mclsFormChanger.Form = Me 
    With mclsFormChanger 
        .ShowCloseBtn = False 
        .ShowSysMenu = False 
        .ShowCaption = False 
    End With 
     
    ResizeForm 
     
     
     
     'SetFormStyle
     
    cmdSave.SetFocus 
     
End Sub 
 ' Comments: Prevent the form being closed using Alt+F4
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) 
    Cancel = (CloseMode = vbFormControlMenu) 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines

In a Module:

	VB:
	
 Range 
Public Sub PopupAPE() 
    Dim PS As Positions 
    Dim fProtected As Boolean, fProtScen As Boolean, fProtDraw As Boolean 
    Dim sRes As String 
    #If VBA6 Then 
        Dim HO As cstFormHorizontalPosition 
        Dim VO As cstFormVerticalPosition 
    #Else 
        Dim HO As Long 
        Dim VO As Long 
    #End If 
     
    HO = cstFhpAuto 'position the form relative to rActive
    VO = cstFvpAuto 'position the form relative to rActive
     
    PS = PositionForm(WhatForm:=ActionPlan, AnchorRange:=apeRng, HorizOrientation:=HO, VertOrientation:=VO) 
     
    With ActionPlan 
        .Caption = "Action Plan: " & ThisWorkbook.Sheets("Open Paper").Range("B" & apeRng.Row).Value 
        .Left = PS.Cell1Left 
        .Top = PS.Cell1Top 
        .SpecialEffect = fmSpecialEffectRaised 
         
        .TextBox1.Value = apeRng.Value 
        .Show vbModal 
    End With 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
Would really appreciate help on this one. Been trying it for a couple of hours without success. Thank you.

Does anyone know if it is possible to open a workbook using a macro, starting the cursor at B2 and making it impossible for the user to move the cursor to any other column, just up or down the B column?

It would be so nice to be able to do that, but I haven't found any way to do it.

Hello, before I begin creating something from scratch I was wondering if there is code available for the following concept:
Would like to have the ability to simulate a text box or even just a floating text that would appear when my cursor hovers over cells that have text in those cells. For example i have a large rectangular grid of cells that have clusters of cells in randomn locations throughout the grid that all have the same ID like "A-00" and "B-00". My goal is to have the user see what the text in the cell is on a larger scale than the fonts of the cells themselves just by moving the cursor around in the grid. The reason is that both my font size and font color makes the cell contents impossible to view given my field of view, which i cannot change. I would even settle for having a text box appear or just the text floating somewhere on the spreadsheet that would appear if I click in any of the cells in the grid and then disappears after i double click or something like that. Is this possible in VBA?

How can I hide or move the cursor away from where I want to type?


No luck finding an answer? You could always try Google.