Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defined names in VBA Excel

Status
Not open for further replies.

kattz

Technical User
Nov 11, 2003
27
AU
I don't have any idea on writing VBA so I need it to be kept really simple if possible. I like to learn and teach myself but I need a really good starting point for this one. I read a previous thread but I didn't understand it at all %-)

I have a worksheet called Noticeboard. This will be printed out on A1 paper so it is very big and I have defined cells with names to make it easier as some of the cells are merged.
For example, I have a defined cell in the worksheet named Project_Leader_Name.

I need to create a userform (this I can do) but it is the linking of information from the userform to the worksheet I don't understand.

The userform text box will be called txtPLName.

I don't want to use the row count,as the information that needs to be filled in is all over the page and not in neat little lines or rows as it contains various information from org charts to policies and notices.

So, for the "write data to worksheet information", what would the code be?

Any help would be very much appreciated.
regards
Kattz [ponytails2]
 
To refer to the named range value, use: Range("ProjectLeaderName").Value
 
Thanks Electricpete,

for the OK button code, do i start it off with just the code you gave me?

the example which points to rows and offsets etc, starts off with
"With worksheets("sheet1").range (A1")

I am lucky that i only have text boxes to deal with and no combo or list boxes.

Also, I need to be able to print out the completed excel spreadsheet when finished (so at the end of the OK button code i will need to open the print operations etc) do you or someone else know how to do that?
thanks
kattz
 


hi,
So, for the "write data to worksheet information", what would the code be?
Code:
Range("Project_Leader_Name").Value = txtPLName.Text

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip,
that worked a treat [thumbsup2] I know that was probable very simple, but we all have to start somewhere [tongue]

what code do i use to close the userform once i have finished entering the data and cleared the userform? (as per the example code below)

Code:
Private Sub cmdok_Click()
    Range("manageroffsite_name").Value = txtMgrOffName.Text
    Range("ohscommittee_name").Value = txtOHSname.Text
    Dim Ctl As Control
On Error Resume Next
For Each Ctl In Me.Controls
    Ctl.Value = Null
Next Ctl
End Sub

do you know of any threads or websites that are good for learners of VBA, just to know what all the words mean would be a great start.
cheers
 


Code:
Private Sub cmdok_Click()
    Range("manageroffsite_name").Value = txtMgrOffName.Text
    Range("ohscommittee_name").Value = txtOHSname.Text
    Dim Ctl As Control
On Error Resume Next
For Each Ctl In Me.Controls
    Ctl.Value = Null
Next Ctl

me.hide
End Sub

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top