• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

"Error next for"

Moroke

New Member
I need assitance in combining this code to be one code , when ever I click the "Add" button to add data from my dropdow if the is "0" to hide that cell....
Code:
Private Sub cmdAdd_Click()
Dim cell As Object
  For Each cell In Selection.Cells
  cell.Value = Cmb
  Next cell
  Unload Me
End Sub

Sub HideRows()
Application.ScreenUpdating = False
Dim cell As Range
  For Each cell In Range("I19:I658")
  If cell.Value = "0" Then
  cell.EntireRow.Hidden = True
  Application.ScreenUpdating = True
  End If
  Next
End Sub

Please I need assistance with this code.
 
Last edited by a moderator:
Like this?
Code:
Private Sub cmdAdd_Click()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Selection.Cells
    cell.Value = cmb
    cell.EntireColumn.Hidden = (cmb = 0)
Next cell
Application.ScreenUpdating = True
Unload Me
End Sub
 
Back
Top