+ Reply to Thread
Results 1 to 3 of 3

I need help with finishing a macro.

Hybrid View

  1. #1
    Registered User
    Join Date
    04-08-2013
    Location
    Wajdušna
    MS-Off Ver
    Office 365
    Posts
    80

    I need help with finishing a macro.

    Hellow,

    Here is the problem; i have equations in column "B" that return a value down to Row x ( in this code to row 35). Some of the rows between B1 and B35 will be left blank. I allready have a code that works on fixed parameters, i would like to modify it so it will work on changing ranges of non blank cells. The code hides empty rows between last cell with the text and row 35

    The code is :
    Sub cell()
    
    Dim cell As String
    
    cell = ThisWorkbook.Sheets("1").Cells(M2, 2).Value
    
    ThisWorkbook.Sheets("1").Rows("1:35").Hidden = False
    
    If cell = "" Then
    ThisWorkbook.Sheets("1").Rows("M2:35").Hidden = True
    End If
    
    End Sub
    The code works if i put in insted of M2 a value.
    M2 is the variable. I want the code to be able look at the sheet "1" and into cell M2 and put the value of that cell into the code.
    If you want you can also write the equation from M2 directly to the code. Equation in cell M2 is = 35-COUNTBLANK(B1:B35)+1

    Thank you for your help
    AT

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: I need help with finishing a macro.

    Sub cell()
    
    Dim cell As String
    
    cell = ThisWorkbook.Sheets("1").Cells(Range("M2"), 2).Value
    
    ThisWorkbook.Sheets("1").Rows("1:35").Hidden = False
    
    If cell = "" Then
    ThisWorkbook.Sheets("1").Rows(Range("M2")&":35").Hidden = True
    End If
    
    End Sub

  3. #3
    Registered User
    Join Date
    04-08-2013
    Location
    Wajdušna
    MS-Off Ver
    Office 365
    Posts
    80

    Re: I need help with finishing a macro.

    Thank you for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Print 10 rows per page - need help finishing macro
    By zarafe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2013, 07:40 PM
  2. [SOLVED] Printing 10 rows per page - need help finishing macro
    By zarafe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2013, 04:01 PM
  3. Loop finishing too early!!
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-16-2013, 01:23 PM
  4. [SOLVED] Loop not finishing
    By boomersooner5136 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-14-2012, 10:51 AM
  5. macro not finishing task
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-29-2007, 07:32 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