LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Selct and edit sheet


I am a bit confused about this as I have never had this happen befo

I have a command button on sheet 1 which is basically for validation of
two fields of data.
Once the validation check gets through I want to copy the two fields
into Sheet 2. But in my code I am selecting sheet 2 but once there and
changes I try to make are happening in sheet 1!!

here is the code:

Private Sub Register_Click()

Dim SName As String
Dim Username As String
Dim Session As String

Dim MyTime
MyTime = Time

If MyTime < "12:00:00" Then
Session = "Morning"
ElseIf MyTime < "17:00:00" Then
Session = "Afternoon"
ElseIf MyTime < "23:59:59" Then
Session = "Evening"
Else
End If


SName = Range("f9")
Username = Range("f11")

If SName = "" Then
MsgBox "Please enter your Surname"
ElseIf Username = "" Then
MsgBox "Please enter your username"
Else

Sheets("Data").Select ' HERE I SELECT THE SHEET I WANT TO COPY TO

Range("a2") = SName ' THIS APPEARS IN SHEET 1 !!!
Range("b2") = Username ' THIS ALSO APPEARS IN SHEET 1 !!!!


End If


Do I need to make the second sheet active before I can copy the data?


--
NNothard
------------------------------------------------------------------------
NNothard's Profile: http://www.excelforum.com/member.php...o&userid=35791
View this thread: http://www.excelforum.com/showthread...hreadid=571431

 
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
Edit Paste Issue pwlyons Excel Discussion (Misc queries) 1 July 9th 05 03:38 AM


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