LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Format a rangeafter usining a userform

I posted this a few days ago and got one reply from Bob Phillips which
unfortunately didn't work.

I have written a Macro to record Registration information for up to 2,000
people registered at a Lions Convention.

I use a userform to enter the information for each Registration. Based on
the type of Registration, I would like to be able to highlight the LastRow
in an appropriate color. Since the database is dynamic, I am having
difficulty selecting the Last row (Uses A(lastRow):l(Lastrow)). This is the
code I have written (albeit not well) so far. It will highlight the very
first cell in the LastRow but will not select entire row.

If anyone can steer me straight I would appreciate it.

My Code
=================================
Private Sub CommandButton1_Click()


Dim LastRow As Object
Dim Response As String
Dim Ts As Integer, Lu As Integer, Sheets2 As Worksheet

' Application.Visible = False
Set LastRow = Sheet1.Range("a65536").End(xlUp)

Ts = 0
Lu = 0
If Sheets.Count < 1 Then Sheets(1).Activate
LastRow.Activate

LastRow.Offset(1, 0).Value = txtName.Text
LastRow.Offset(1, 1).Value = txtClub.Text
LastRow.Offset(1, 2).Value = cmbDist.Text
LastRow.Offset(1, 3).Value = 1 ' txtPersons.Text

On Error Resume Next

If CheckBox1 = True Or CheckBox2 = True Then
LastRow.Offset(1, 4).Value = 10
Else
LastRow.Offset(1, 4).Value = 20
End If

If CheckBox1 = True Then
MsgBox ("Sun Only - No Room deposit required!")
LastRow.Offset(1, 5).Value = ""
End If

If CheckBox2 = True Then
MsgBox ("This is a Leo - Registration is only One Half!")

Else
LastRow.Offset(1, 5).Value = txtRoomDep.Text
End If

LastRow.Offset(1, 8).Value = txtLunch.Text
Lu = LastRow.Offset(1, 8).Value * 25
Ts = Ts + Lu
LastRow.Offset(1, 9).Value = txtTheatre.Text
Lu = LastRow.Offset(1, 9).Value * 30
Ts = Ts + Lu
LastRow.Offset(1, 10).Value = txtBanquet.Text
Lu = LastRow.Offset(1, 10).Value * 55
Ts = Ts + Lu
LastRow.Offset(1, 11).Value = txtDance.Text
Lu = LastRow.Offset(1, 11).Value * 5
Ts = Ts + Lu
LastRow.Offset(1, 6).Value = Ts

If OptionButton1 = True Then
LastRow.Offset(1, 14).Value = "M" ' Using Master Card
End If
If OptionButton2 = True Then
LastRow.Offset(1, 14).Value = "V" ' Using Visa
End If
Set LastRow = Sheet1.Range("a65536").End(xlUp)
LastRow.Activate

Range.Cells("A(LastRow):L(LastRow)").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.ColorIndex = 10
End With


MsgBox "One record written to Sheet1"


================================================== ===

DennisB



 
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
Is there a way to have fixed format in a userform? [email protected] Excel Discussion (Misc queries) 9 February 19th 08 11:44 PM
format userform text box Zygan Excel Discussion (Misc queries) 3 July 12th 06 03:25 PM
Date format in userform cutsygurl Excel Programming 3 April 19th 06 09:44 AM
How to format Userform caption? davidm Excel Programming 2 October 3rd 05 07:26 PM
Userform format question Martha[_2_] Excel Programming 5 May 17th 04 11:55 PM


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