Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Reading location of active cell

Hello,
For my project I am making on excel, I need to move the selected cell
up so for example if I click on A2 then A1 would be selected
Is this possible,
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Reading location of active cell

ActiveCell.Offset(-1,0).select

If the cursor is in row 1 when you try to do this command you will recieve
an error, To avoid this you can do so:

If ActiveCell.Row1 then
ActiveCell.Offset(-1,0).select
End If

Hopes this helps.

---
Per


"Dean" skrev i meddelelsen
...
Hello,
For my project I am making on excel, I need to move the selected cell
up so for example if I click on A2 then A1 would be selected
Is this possible,
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading location of active cell

On Apr 18, 1:46*pm, "Per Jessen" wrote:
ActiveCell.Offset(-1,0).select

If the cursor is in row 1 when you try to do this command you will recieve
an error, To avoid this you can do so:

If ActiveCell.Row1 then
* * ActiveCell.Offset(-1,0).select
End If

Hopes this helps.

---
Per

"Dean" skrev i ...



Hello,
For my project I am making on excel, I need to move the selected cell
up so for example if I click on A2 then A1 would be selected
Is this possible,
Thanks- Hide quoted text -


- Show quoted text -


Hey thanks for your reply,
but what I meant was that it would move up by one, not to move upto
the first row, i put in sheet1.section change, but what I think
happens is that you click, it moves up a row, and then it re- does the
sheet1.sectionchange, do you get what I mean?
thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Reading location of active cell

No problem,

You have to turn off events before the macro moves up one row:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
If ActiveCell.Row 1 Then
ActiveCell.Offset(-1, 0).Select
End If
Application.EnableEvents = True
End Sub

Best wishes

Per

skrev i meddelelsen
...
On Apr 18, 1:46 pm, "Per Jessen" wrote:
ActiveCell.Offset(-1,0).select

If the cursor is in row 1 when you try to do this command you will recieve
an error, To avoid this you can do so:

If ActiveCell.Row1 then
ActiveCell.Offset(-1,0).select
End If

Hopes this helps.

---
Per

"Dean" skrev i
...



Hello,
For my project I am making on excel, I need to move the selected cell
up so for example if I click on A2 then A1 would be selected
Is this possible,
Thanks- Hide quoted text -


- Show quoted text -


Hey thanks for your reply,
but what I meant was that it would move up by one, not to move upto
the first row, i put in sheet1.section change, but what I think
happens is that you click, it moves up a row, and then it re- does the
sheet1.sectionchange, do you get what I mean?
thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show value from specific column based on location of active cell Spuds Glorious Spuds Excel Discussion (Misc queries) 1 November 5th 08 05:43 PM
Move active cell to same location on each worksheet BeanoKid Excel Discussion (Misc queries) 3 April 15th 08 11:29 PM
On Opening Excel WB the Active cell location never changes den4673 Excel Discussion (Misc queries) 1 March 4th 08 04:51 PM
reading blank cell as active - how can I stop it ? Nu-bEE Excel Discussion (Misc queries) 1 March 20th 05 10:45 PM
Ho do I determine the Active Cell location of the data being sele. Hibbs Excel Programming 2 March 17th 05 09:19 PM


All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"