Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 275
Default Userform question

In Cell A2 of my data worksheet I want this value to be placed in a userform
(frmEdit) so that it can be edited, once changed the user 'submits' the data
and it is placed into cell A2 replacing what was there before....

any ideas how this can be done??
THanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,533
Default Userform question

Hi

Look at the code below. The UserForm_Initialize will fire when you "run"
your form. I assume that you have a commandbutton named cmbSubmit on your
userform. The code needs to be copied to the codesheet for the userform.

Private Sub cmbSubmit_Click()
Sheets("Sheet1").Range("A2").Value = Me.TextBox1.Value
End Sub

Private Sub UserForm_Initialize()
Me.TextBox1.Value = Range("A2").Value
End Sub

Regards,
Per

"Anthony" skrev i meddelelsen
...
In Cell A2 of my data worksheet I want this value to be placed in a
userform
(frmEdit) so that it can be edited, once changed the user 'submits' the
data
and it is placed into cell A2 replacing what was there before....

any ideas how this can be done??
THanks in advance


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Userform question

Private Sub Userform_Activate()
Me.TextBox1.Text = Worksheets("Sheet1").Range("A2").Value
End Sub

Private Sub TextBox1_AfterUpdate
Worksheets("Sheet1").Range("A2").Value = Me.TextBox1.Text
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Anthony" wrote in message
...
In Cell A2 of my data worksheet I want this value to be placed in a
userform
(frmEdit) so that it can be edited, once changed the user 'submits' the
data
and it is placed into cell A2 replacing what was there before....

any ideas how this can be done??
THanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 275
Default Userform question

Thanks for ur replys - can I expand on my inital question?
My userform frmEditjobref is displayed when the user clicks on the 'edit
job' button.
They input a specific job ref number.
I want column A of workshet DATA to be searched (cells A12:A100) for the
number entered into the userform, if found copy/paste this rows data into row
A2 of the EDIT JOB RESULTS worksheet.
each value A2,B2,C2,D3 etc will then be placed into the form frmEditJob so
that they can be edited.
So data in A2 should be placed into userform 'txtctc' box
data in A3 placed into 'txttime' box, etc etc

Once the user has finished editing the data shown in the userform they add
the data (command button) back to the DATA worksheet, replacing what was
there originaly

Oh and if the original ref can't be found through column A of the DATA
worksheet then a msg pop up to advise so...........


etc etc

"Per Jessen" wrote:

Hi

Look at the code below. The UserForm_Initialize will fire when you "run"
your form. I assume that you have a commandbutton named cmbSubmit on your
userform. The code needs to be copied to the codesheet for the userform.

Private Sub cmbSubmit_Click()
Sheets("Sheet1").Range("A2").Value = Me.TextBox1.Value
End Sub

Private Sub UserForm_Initialize()
Me.TextBox1.Value = Range("A2").Value
End Sub

Regards,
Per

"Anthony" skrev i meddelelsen
...
In Cell A2 of my data worksheet I want this value to be placed in a
userform
(frmEdit) so that it can be edited, once changed the user 'submits' the
data
and it is placed into cell A2 replacing what was there before....

any ideas how this can be done??
THanks in advance



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,533
Default Userform question

Hi

Look at the codes below (untested). Just make sure that the subs goes into
the right userforms.

Dim TargetCells As Range
Dim DestRow As Integer
Dim ws As Worksheet
Dim ws1 As Worksheet

Private Sub cmbFindJobRef_Click()
'frmEditJobRef
Set ws = Worksheets("Data")
TargetCells = Range("A12:A100")

Set DestRow = ws.TargetCells.Find(what:=JobID, LookIn:=xlValues, _
Lookat:=xlWhole, searchdirection:=xlNext).Row
If DestRow Is Nothing Then
msg = MsgBox("JobID was not found!", vbExclamation, "Warning")
Exit Sub
End If
ws.Rows(DestRow).Copy Destination:=Sheets("EDIT JOB RESULTS").Range("A2")
frmEditJob.Show
End Sub

Private Sub CommandButton1_Click()
'frmEditJob

ws.Cells(DestRow, "A") = Me.txtctc.Value
ws.Cells(DestRow, "B") = Me.txttime.Value
' etc.
End Sub

Private Sub UserForm_Activate()
' frmEditJob
Dim ws1 As Worksheet
Set ws1 = Worksheets("EDIT JOB RESULTS")
Me.txtctc.Value = ws1.Range("A2").Value
Me.txttime.Value = ws1.Range("B2").Value
' Etc.
End Sub

Regards,
Per

"Anthony" skrev i meddelelsen
...
Thanks for ur replys - can I expand on my inital question?
My userform frmEditjobref is displayed when the user clicks on the 'edit
job' button.
They input a specific job ref number.
I want column A of workshet DATA to be searched (cells A12:A100) for the
number entered into the userform, if found copy/paste this rows data into
row
A2 of the EDIT JOB RESULTS worksheet.
each value A2,B2,C2,D3 etc will then be placed into the form frmEditJob so
that they can be edited.
So data in A2 should be placed into userform 'txtctc' box
data in A3 placed into 'txttime' box, etc etc

Once the user has finished editing the data shown in the userform they add
the data (command button) back to the DATA worksheet, replacing what was
there originaly

Oh and if the original ref can't be found through column A of the DATA
worksheet then a msg pop up to advise so...........


etc etc

"Per Jessen" wrote:

Hi

Look at the code below. The UserForm_Initialize will fire when you "run"
your form. I assume that you have a commandbutton named cmbSubmit on your
userform. The code needs to be copied to the codesheet for the userform.

Private Sub cmbSubmit_Click()
Sheets("Sheet1").Range("A2").Value = Me.TextBox1.Value
End Sub

Private Sub UserForm_Initialize()
Me.TextBox1.Value = Range("A2").Value
End Sub

Regards,
Per

"Anthony" skrev i meddelelsen
...
In Cell A2 of my data worksheet I want this value to be placed in a
userform
(frmEdit) so that it can be edited, once changed the user 'submits' the
data
and it is placed into cell A2 replacing what was there before....

any ideas how this can be done??
THanks in advance




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
UserForm Question Mr BT[_3_] Excel Worksheet Functions 0 August 20th 07 04:56 AM
Userform combobox question teepee Excel Discussion (Misc queries) 2 May 17th 07 09:22 AM
Another Userform question. ingleg Excel Discussion (Misc queries) 1 July 6th 06 01:17 PM
Userform question Greg B Excel Discussion (Misc queries) 1 May 13th 05 01:06 PM
Userform Question Greg B Excel Discussion (Misc queries) 3 March 10th 05 10:46 AM


All times are GMT +1. The time now is 04:36 PM.

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"