Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Accessing a non-active sheet from a userform

I have a user form that lets the user enter data to be added to a sheet that
I would like to keep hidden from view.

If I activate the sheet first with this:

Sheets("Replace Info").Activate

then the following works to determine the next row for adding the user's
entries:

NextRow = Application.WorksheetFunction._
CountA(Range("A:A")) + 1

So, I thought this might work if I didn't activate the sheet first:

NextRow = Application.WorksheetFunction.Sheets("Replace Info") _
CountA(Range("A:A")) + 1

Clearly I do not understand something, 'cause that didn't work.

Can anyone help me out?

And, to avoid posting back here after I get an answer to that, the following
code works to put the value into a cell on the sheet if I activate it first:

Cells(NextRow, 1) = Find_What.Text

And, I tried this with the sheet not activated:

Sheets("Replace Info").Cells(NextRow, 1) = Find_What.Text

but it never got there because of the problem described above.

Will that work, and if not, what will work?

Thanks,
Ken Loomis





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Accessing a non-active sheet from a userform

NextRow = Application.WorksheetFunction.CountA(Sheets("Repla ce
Info").Range("A:A")) + 1

or

NextRow = Sheets("Replace Info").Cells(rows.count,1).End(xlup)(2).Row

--
Regards,
Tom Ogilvy


"Ken Loomis" wrote in message
...
I have a user form that lets the user enter data to be added to a sheet

that
I would like to keep hidden from view.

If I activate the sheet first with this:

Sheets("Replace Info").Activate

then the following works to determine the next row for adding the user's
entries:

NextRow = Application.WorksheetFunction._
CountA(Range("A:A")) + 1

So, I thought this might work if I didn't activate the sheet first:

NextRow = Application.WorksheetFunction.Sheets("Replace Info") _
CountA(Range("A:A")) + 1

Clearly I do not understand something, 'cause that didn't work.

Can anyone help me out?

And, to avoid posting back here after I get an answer to that, the

following
code works to put the value into a cell on the sheet if I activate it

first:

Cells(NextRow, 1) = Find_What.Text

And, I tried this with the sheet not activated:

Sheets("Replace Info").Cells(NextRow, 1) = Find_What.Text

but it never got there because of the problem described above.

Will that work, and if not, what will work?

Thanks,
Ken Loomis







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Accessing a non-active sheet from a userform

Thanks, Tom.

That did it and also helped me figure out how to access the cells on that
non-active sheet.

Ken Loomis

"Tom Ogilvy" wrote in message
...
NextRow = Application.WorksheetFunction.CountA(Sheets("Repla ce
Info").Range("A:A")) + 1

or

NextRow = Sheets("Replace Info").Cells(rows.count,1).End(xlup)(2).Row

--
Regards,
Tom Ogilvy


"Ken Loomis" wrote in message
...
I have a user form that lets the user enter data to be added to a sheet

that
I would like to keep hidden from view.

If I activate the sheet first with this:

Sheets("Replace Info").Activate

then the following works to determine the next row for adding the user's
entries:

NextRow = Application.WorksheetFunction._
CountA(Range("A:A")) + 1

So, I thought this might work if I didn't activate the sheet first:

NextRow = Application.WorksheetFunction.Sheets("Replace Info") _
CountA(Range("A:A")) + 1

Clearly I do not understand something, 'cause that didn't work.

Can anyone help me out?

And, to avoid posting back here after I get an answer to that, the

following
code works to put the value into a cell on the sheet if I activate it

first:

Cells(NextRow, 1) = Find_What.Text

And, I tried this with the sheet not activated:

Sheets("Replace Info").Cells(NextRow, 1) = Find_What.Text

but it never got there because of the problem described above.

Will that work, and if not, what will work?

Thanks,
Ken Loomis









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
Accessing Other Sheet Tabs from within Excel Eric Excel Worksheet Functions 4 August 21st 09 06:20 PM
Problem seeing and accessing top of sheet egii Excel Discussion (Misc queries) 1 January 11th 07 02:52 AM
Userform Listbox using an active sheet [email protected] Excel Discussion (Misc queries) 0 March 1st 06 08:22 PM
Accessing Active X command button properties greg Excel Programming 2 July 20th 04 09:04 PM
Accessing a textbox on a sheet.... Cyril[_2_] Excel Programming 1 August 11th 03 06:37 PM


All times are GMT +1. The time now is 03:57 PM.

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"