#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Cell index?

When you open an excel document which properties do you set so the form will
open also ( Ive got an form with some textboxes and command buttons on it).
And how do you setfocus back on the excel worksheet (sheet1). I need to know
the index of the cell that is clicked on.
Im working on a word game for my kids and I got the main part of the code
done, just need to do some fine-tuning

--
thank You
Gus Chuchanis
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Cell index?

Hi,

To start your code when opening a xl file, put your code (eg:
Userform1.Show) in the ThisWorkbook code module, in the event handler:
Private Sub Workbook_Open()
Userform1.show
End Sub

For your 2nd question, do you mean you want the user to be able to click the
active sheet while the form is displayed?
If so, 3 ways:

1- make the form modeless
UserForm1.Show vbModeless

2- use a RefEdit box control. It is the same contro as when you go in menu
Insert Name Define, box 'Refers To'. It has a red square on the right
which lets you hide the form and select a range.
To be able to use this control, right-click on the Toolbox toolbar
Additional Control, select the RefEdt.Ctl control.

3- if possible, replace the form by a (floating) toolbar.

I hope this helps,
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

When you open an excel document which properties do you set so the form will
open also ( Ive got an form with some textboxes and command buttons on it).
And how do you setfocus back on the excel worksheet (sheet1). I need to know
the index of the cell that is clicked on.
Im working on a word game for my kids and I got the main part of the code
done, just need to do some fine-tuning

--
thank You
Gus Chuchanis

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Cell index?

Ok that all worked out great, but how do I read the current cells position.
It would be the highlighted cell on the worksheet. I need this position for
the stating point in an for-next loop.
€˜my test event to read the current position
Private Sub cmdShowPosition_Click()
txtPosition.Value = Sheet1. ActiveCell.LocationInTable
End Sub

--
thank You


"sebastienm" wrote:

Hi,

To start your code when opening a xl file, put your code (eg:
Userform1.Show) in the ThisWorkbook code module, in the event handler:
Private Sub Workbook_Open()
Userform1.show
End Sub

For your 2nd question, do you mean you want the user to be able to click the
active sheet while the form is displayed?
If so, 3 ways:

1- make the form modeless
UserForm1.Show vbModeless

2- use a RefEdit box control. It is the same contro as when you go in menu
Insert Name Define, box 'Refers To'. It has a red square on the right
which lets you hide the form and select a range.
To be able to use this control, right-click on the Toolbox toolbar
Additional Control, select the RefEdt.Ctl control.

3- if possible, replace the form by a (floating) toolbar.

I hope this helps,
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

When you open an excel document which properties do you set so the form will
open also ( Ive got an form with some textboxes and command buttons on it).
And how do you setfocus back on the excel worksheet (sheet1). I need to know
the index of the cell that is clicked on.
Im working on a word game for my kids and I got the main part of the code
done, just need to do some fine-tuning

--
thank You
Gus Chuchanis

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Cell index?

Try:

Dim rg as range

''' return the selected cell(s) - may be multiple cells
Set rg= Selection

''' within these selected cells, one is highlighted in white.
''' It is the active cell (single cell)
Set rg=ActiveCell

''' to get the row or column numbers:
Debug.print rg.row & " - " & rg.column

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

Ok that all worked out great, but how do I read the current cells position.
It would be the highlighted cell on the worksheet. I need this position for
the stating point in an for-next loop.
€˜my test event to read the current position
Private Sub cmdShowPosition_Click()
txtPosition.Value = Sheet1. ActiveCell.LocationInTable
End Sub

--
thank You


"sebastienm" wrote:

Hi,

To start your code when opening a xl file, put your code (eg:
Userform1.Show) in the ThisWorkbook code module, in the event handler:
Private Sub Workbook_Open()
Userform1.show
End Sub

For your 2nd question, do you mean you want the user to be able to click the
active sheet while the form is displayed?
If so, 3 ways:

1- make the form modeless
UserForm1.Show vbModeless

2- use a RefEdit box control. It is the same contro as when you go in menu
Insert Name Define, box 'Refers To'. It has a red square on the right
which lets you hide the form and select a range.
To be able to use this control, right-click on the Toolbox toolbar
Additional Control, select the RefEdt.Ctl control.

3- if possible, replace the form by a (floating) toolbar.

I hope this helps,
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

When you open an excel document which properties do you set so the form will
open also ( Ive got an form with some textboxes and command buttons on it).
And how do you setfocus back on the excel worksheet (sheet1). I need to know
the index of the cell that is clicked on.
Im working on a word game for my kids and I got the main part of the code
done, just need to do some fine-tuning

--
thank You
Gus Chuchanis

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Cell index?

Seem's to work great.
So range must be an object and we are creating and instance of that object
with
Dim rg As Range
I didnt know excel had VB capabilities like this, any suggested reading or
text books that you recommend

--
thank You


"sebastienm" wrote:

Try:

Dim rg as range

''' return the selected cell(s) - may be multiple cells
Set rg= Selection

''' within these selected cells, one is highlighted in white.
''' It is the active cell (single cell)
Set rg=ActiveCell

''' to get the row or column numbers:
Debug.print rg.row & " - " & rg.column

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

Ok that all worked out great, but how do I read the current cells position.
It would be the highlighted cell on the worksheet. I need this position for
the stating point in an for-next loop.
€˜my test event to read the current position
Private Sub cmdShowPosition_Click()
txtPosition.Value = Sheet1. ActiveCell.LocationInTable
End Sub

--
thank You


"sebastienm" wrote:

Hi,

To start your code when opening a xl file, put your code (eg:
Userform1.Show) in the ThisWorkbook code module, in the event handler:
Private Sub Workbook_Open()
Userform1.show
End Sub

For your 2nd question, do you mean you want the user to be able to click the
active sheet while the form is displayed?
If so, 3 ways:

1- make the form modeless
UserForm1.Show vbModeless

2- use a RefEdit box control. It is the same contro as when you go in menu
Insert Name Define, box 'Refers To'. It has a red square on the right
which lets you hide the form and select a range.
To be able to use this control, right-click on the Toolbox toolbar
Additional Control, select the RefEdt.Ctl control.

3- if possible, replace the form by a (floating) toolbar.

I hope this helps,
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

When you open an excel document which properties do you set so the form will
open also ( Ive got an form with some textboxes and command buttons on it).
And how do you setfocus back on the excel worksheet (sheet1). I need to know
the index of the cell that is clicked on.
Im working on a word game for my kids and I got the main part of the code
done, just need to do some fine-tuning

--
thank You
Gus Chuchanis



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Cell index?

Exactly.

A few books:
- "Excel 200x Power Programming with VBA"
- "Professional Excel Development"
- "Excel 200x VBA Programmer's reference"
More on amazon.com, search for: VBA Excel

Other learning methods:
- this newsgroup
- help system: search for 'Excel Object Model' - good starting point to see
how xl objects (more than 120 of them) relate to each other (also click to
drill-down).
- object brower (key F2): info about an object , sub, function... (from
there press F1 for details)
- many websites like http://www.contextures.com/tiptech.html (from there,
in the E section, you'll find links to other sites

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

Seem's to work great.
So range must be an object and we are creating and instance of that object
with
Dim rg As Range
I didnt know excel had VB capabilities like this, any suggested reading or
text books that you recommend

--
thank You


"sebastienm" wrote:

Try:

Dim rg as range

''' return the selected cell(s) - may be multiple cells
Set rg= Selection

''' within these selected cells, one is highlighted in white.
''' It is the active cell (single cell)
Set rg=ActiveCell

''' to get the row or column numbers:
Debug.print rg.row & " - " & rg.column

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

Ok that all worked out great, but how do I read the current cells position.
It would be the highlighted cell on the worksheet. I need this position for
the stating point in an for-next loop.
€˜my test event to read the current position
Private Sub cmdShowPosition_Click()
txtPosition.Value = Sheet1. ActiveCell.LocationInTable
End Sub

--
thank You


"sebastienm" wrote:

Hi,

To start your code when opening a xl file, put your code (eg:
Userform1.Show) in the ThisWorkbook code module, in the event handler:
Private Sub Workbook_Open()
Userform1.show
End Sub

For your 2nd question, do you mean you want the user to be able to click the
active sheet while the form is displayed?
If so, 3 ways:

1- make the form modeless
UserForm1.Show vbModeless

2- use a RefEdit box control. It is the same contro as when you go in menu
Insert Name Define, box 'Refers To'. It has a red square on the right
which lets you hide the form and select a range.
To be able to use this control, right-click on the Toolbox toolbar
Additional Control, select the RefEdt.Ctl control.

3- if possible, replace the form by a (floating) toolbar.

I hope this helps,
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gus Chuch" wrote:

When you open an excel document which properties do you set so the form will
open also ( Ive got an form with some textboxes and command buttons on it).
And how do you setfocus back on the excel worksheet (sheet1). I need to know
the index of the cell that is clicked on.
Im working on a word game for my kids and I got the main part of the code
done, just need to do some fine-tuning

--
thank You
Gus Chuchanis

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
Index of Max Cell Nate Excel Discussion (Misc queries) 7 October 20th 09 03:24 PM
Row and Col Index of a cell with Max Value mario Excel Worksheet Functions 3 February 26th 08 08:48 PM
know row index via Cell --== Alain ==-- Excel Programming 1 January 22nd 07 02:19 PM
Put a Formula into a Cell with Index alberto via OfficeKB.com Excel Programming 8 January 8th 06 08:22 PM
autofill according to cell index. honour Excel Discussion (Misc queries) 1 December 2nd 04 01:49 PM


All times are GMT +1. The time now is 01:57 AM.

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

About Us

"It's about Microsoft Excel"