Results 1 to 3 of 3

define worksheet question

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-05-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    360

    define worksheet question

    I have the code below that deletes a row based on a textbox value in a userform.

    i need to define the worksheet to = "PROJECTS" but somethings not right here:

       lastrow = Worksheets("PROJECTS").UsedRange.Rows.Count
    probably a simple fix but i'm stuck on it. any help is appreciated. Thanks!


    Private Sub deletejob_Click()
    
     Select Case MsgBox("ARE YOU SURE YOU WANT TO DELETE THIS PROJECT?", vbYesNo)
        Case vbYes
        
       Application.ScreenUpdating = False
       Application.Calculation = xlCalculationManual
       Dim lastrow As Long, r As Long
       lastrow = Worksheets("PROJECTS").UsedRange.Rows.Count
       For r = lastrow To 1 Step -1
          If UCase(Cells(r, 3).Value) = jobno Then Rows(r).Delete
       Next r
       Application.Calculation = xlCalculationAutomatic
       Application.ScreenUpdating = True
       
           Case vbNo
    
    End Select
       
    End Sub
    Last edited by adamheon; 01-14-2017 at 01:22 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. <Question> How to use Variables to define a Range of cells.
    By Thelps in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2015, 11:55 AM
  2. Define Name or Worksheet to use?
    By calvinle in forum Excel General
    Replies: 6
    Last Post: 09-17-2014, 04:47 AM
  3. [SOLVED] Define contents entire worksheet
    By dspeters in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-09-2014, 02:53 AM
  4. [SOLVED] How to define a range in another worksheet ?
    By SelAli in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2014, 06:35 PM
  5. Define a Workbook/WorkSheet Name by a String Value
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-20-2009, 12:29 PM
  6. [SOLVED] How to take the worksheet name as a variable(Label/Define) in a fo
    By Subin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-14-2006, 08:45 AM
  7. [SOLVED] how can i define initial worksheet
    By Miqueias Lucas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-20-2005, 02:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1