Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Selecting an active cell

Hello all,
I have a userform that is opened from a button on a worksheet.

Private Sub
range(A11).select
frm_W2.show
End Sub

The userform is opened after cell A11 is selected because when the userform
opens I want it to populate itself with the first record's data on the
worksheet.
The reason I don't select the cell in this sub is because I need to call
this code up later to repopulate another record.

frm_W2.tb_EIN.Value = ws.Cells(ActiveCell).Value
frm_wc.tb_2.value = ws.Cells.Offset(0,1).Value
and so on...

I get a type mismatch with the first line.

Can someone help with this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Selecting an active cell

frm_W2.tb_EIN.Value = ActiveCell.Value
--
HTH...

Jim Thomlinson


"TimT" wrote:

Hello all,
I have a userform that is opened from a button on a worksheet.

Private Sub
range(A11).select
frm_W2.show
End Sub

The userform is opened after cell A11 is selected because when the userform
opens I want it to populate itself with the first record's data on the
worksheet.
The reason I don't select the cell in this sub is because I need to call
this code up later to repopulate another record.

frm_W2.tb_EIN.Value = ws.Cells(ActiveCell).Value
frm_wc.tb_2.value = ws.Cells.Offset(0,1).Value
and so on...

I get a type mismatch with the first line.

Can someone help with this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Selecting an active cell

Cells normally takes a row,column argument. I just tried the following:
activesheet.cells(6,5).value = "san diego"
from the immediate pane, but instead of 6,5 I used activecell and got a type
mismatch error. When I substituted the above, it worked.
HTH.

"TimT" wrote:

Hello all,
I have a userform that is opened from a button on a worksheet.

Private Sub
range(A11).select
frm_W2.show
End Sub

The userform is opened after cell A11 is selected because when the userform
opens I want it to populate itself with the first record's data on the
worksheet.
The reason I don't select the cell in this sub is because I need to call
this code up later to repopulate another record.

frm_W2.tb_EIN.Value = ws.Cells(ActiveCell).Value
frm_wc.tb_2.value = ws.Cells.Offset(0,1).Value
and so on...

I get a type mismatch with the first line.

Can someone help with this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Selecting an active cell

Thanks for your help.
Is the second line of code correct? or should it be
frm_wc.tb_2.value = ActiveCell.Offset(0,1).Value

"Jim Thomlinson" wrote:

frm_W2.tb_EIN.Value = ActiveCell.Value
--
HTH...

Jim Thomlinson


"TimT" wrote:

Hello all,
I have a userform that is opened from a button on a worksheet.

Private Sub
range(A11).select
frm_W2.show
End Sub

The userform is opened after cell A11 is selected because when the userform
opens I want it to populate itself with the first record's data on the
worksheet.
The reason I don't select the cell in this sub is because I need to call
this code up later to repopulate another record.

frm_W2.tb_EIN.Value = ws.Cells(ActiveCell).Value
frm_wc.tb_2.value = ws.Cells.Offset(0,1).Value
and so on...

I get a type mismatch with the first line.

Can someone help with this?

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
Selecting cells on active row merry_fay Excel Discussion (Misc queries) 1 May 26th 09 05:30 PM
Selecting active area of sheet cfspahn24 Excel Discussion (Misc queries) 4 April 17th 06 12:19 PM
Selecting the active row el_grimley Excel Programming 2 August 5th 05 09:19 AM
Selecting Previously Active Cell Harald Staff Excel Programming 1 July 1st 04 08:00 PM
Selecting Active Cell before Text Import Routine Paul Excel Programming 2 November 17th 03 10:01 PM


All times are GMT +1. The time now is 12:16 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"