Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Data Entry for 50 Rows only

Hi Everyone,

I want to make a Function that Restrict Entry in the 'Data' (sheet1)
Sheet once the data entry reached to row no. 54. by defalt I Run the
Macro "Rows_Hide"
it hides all the rows from 55 to the end of the sheet.

When user enter the data till row no. 55 then the message will appear,
the sheet is full, pls click on the Activation button.,

when user click on the activation button, the an other macro will
"Rows_Show" it will unhide the all rows in the Data sheet, after doing
this, user enable to enter the more data in Data Sheet.

how it will possible, pls guide me.


USERFORM CODE:
-----------------------------

Private Sub CommandButton1_Click()
Dim LastRow As Object

' Sheet1 is named "Data"

Set LastRow = Sheet1.Range("B65536").End(xlUp)

LastRow.Offset(1, 0).Value = Name1.Text
LastRow.Offset(1, 1).Value = Company.Text
LastRow.Offset(1, 2).Value = City.Text
LastRow.Offset(1, 3).Value = Mobile.Text
LastRow.Offset(1, 4).Value = Phone11.Text
LastRow.Offset(1, 5).Value = Phone22.Text
LastRow.Offset(1, 6).Value = Fax.Text
LastRow.Offset(1, 7).Value = EMail.Text

If MsgBox("One record is written, do you have more entries ?",
vbYesNo, "Title") = vbYes Then

Call UserForm_Initialize

Else
Unload Me
End If
End If

End Sub



NORMAL MODULE CODE:
-------------------------------------

Sub Rows_Hide()

Sheet1.Unprotect Password:="marketing"
Sheets("Data").Rows("55:65536").EntireRow.Hidden = True
Sheet1.Protect Password:="marketing"

End Sub


Sub Rows_Show()

Sheet1.Unprotect Password:="marketing"
Sheets("Data").Rows("7:65536").EntireRow.Hidden = False
Sheet1.Protect Password:="marketing"

End Sub

Regards.


Shahzad
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Data Entry for 50 Rows only

Hi

Try this:

Private Sub CommandButton1_Click()
Dim LastRow As Object

' Sheet1 is named "Data"

Set LastRow = Sheet1.Range("B65536").End(xlUp)

If LastRow.Row + 1 = 55 Then
msg = MsgBox("The sheet is full." & vbLf & _
"Please click on the Activation button.", vbInformation, "Warning")
Exit Sub
End If


LastRow.Offset(1, 0).Value = Name1.Text
LastRow.Offset(1, 1).Value = Company.Text
LastRow.Offset(1, 2).Value = City.Text
LastRow.Offset(1, 3).Value = Mobile.Text
LastRow.Offset(1, 4).Value = Phone11.Text
LastRow.Offset(1, 5).Value = Phone22.Text
LastRow.Offset(1, 6).Value = Fax.Text
LastRow.Offset(1, 7).Value = EMail.Text


If LastRow.Row + 1 = 54 Then Call Rows_Hide

If MsgBox("One record is written, do you have more entries ?", _
vbYesNo, "Title") = vbYes Then

Call UserForm_Initialize

Else
Unload Me
End If

End Sub

To make all rows visible, you have to refer to the same range which
previusly set .hidden =true.

BTW: It's not needed to use the EntireRow statement as you are already
refering to the row : sheet1.Rows("55:65536").Hidden= False

Sub Rows_Show()

Sheet1.Unprotect Password:="marketing"
Sheet1.Rows("55:65536").EntireRow.Hidden = False
Sheet1.Protect Password:="marketing"

End Sub

Regards,
Per

"Shazi" skrev i meddelelsen
...
Hi Everyone,

I want to make a Function that Restrict Entry in the 'Data' (sheet1)
Sheet once the data entry reached to row no. 54. by defalt I Run the
Macro "Rows_Hide"
it hides all the rows from 55 to the end of the sheet.

When user enter the data till row no. 55 then the message will appear,
the sheet is full, pls click on the Activation button.,

when user click on the activation button, the an other macro will
"Rows_Show" it will unhide the all rows in the Data sheet, after doing
this, user enable to enter the more data in Data Sheet.

how it will possible, pls guide me.


USERFORM CODE:
-----------------------------

Private Sub CommandButton1_Click()
Dim LastRow As Object

' Sheet1 is named "Data"

Set LastRow = Sheet1.Range("B65536").End(xlUp)

LastRow.Offset(1, 0).Value = Name1.Text
LastRow.Offset(1, 1).Value = Company.Text
LastRow.Offset(1, 2).Value = City.Text
LastRow.Offset(1, 3).Value = Mobile.Text
LastRow.Offset(1, 4).Value = Phone11.Text
LastRow.Offset(1, 5).Value = Phone22.Text
LastRow.Offset(1, 6).Value = Fax.Text
LastRow.Offset(1, 7).Value = EMail.Text

If MsgBox("One record is written, do you have more entries ?",
vbYesNo, "Title") = vbYes Then

Call UserForm_Initialize

Else
Unload Me
End If
End If

End Sub



NORMAL MODULE CODE:
-------------------------------------

Sub Rows_Hide()

Sheet1.Unprotect Password:="marketing"
Sheets("Data").Rows("55:65536").EntireRow.Hidden = True
Sheet1.Protect Password:="marketing"

End Sub


Sub Rows_Show()

Sheet1.Unprotect Password:="marketing"
Sheets("Data").Rows("7:65536").EntireRow.Hidden = False
Sheet1.Protect Password:="marketing"

End Sub

Regards.


Shahzad


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
Auto copy data rows between sheets depending on date entry Struggling in Sheffield[_2_] New Users to Excel 3 September 27th 09 01:36 PM
Data entry on filtered rows. Lisa954 Excel Worksheet Functions 4 March 9th 09 11:52 PM
Save 60% on Data Entry, Data Conversion, Data Processing Services byOffshore-Data-Entry [email protected] Excel Programming 0 June 4th 08 04:02 PM
Save 60% on Data Entry, Data Conversion, Data Processing Services byOffshore-Data-Entry [email protected] Excel Programming 0 June 4th 08 04:00 PM
Data Entry Online, Data Format, Data Conversion and Data EntryServices through Data Entry Outsourcing [email protected] Excel Discussion (Misc queries) 0 March 20th 08 12:45 PM


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