help with VB

rcirone

Active Member
Joined
Mar 12, 2009
Messages
483
Office Version
  1. 365
Platform
  1. Windows
I am looking for something if I have formula 7cells from A1 to G1 pulling info over. If one of the cell do not pull info over an it delete the row or line. like if info does not show up in cells D1,E1 and F1


Help please
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I got this off of mr excel and this is what I am trying to do

Sub Whateveryouwanttocalltheprocedure()
Dim c As Range
For Each c In Range("U2:U50")
Range ("v2:v50")
Range ("w2:w50")
If c.Value = "" Then
c.EntireRow.Hidden = True
Else
c.EntireRow.Hidden = False
End If
Next c
End Sub
 
Upvote 0
.

Your posts are confusing. In #1 you seem to be looking for a means to hide rows if something is blank.

In #2 you are wanting to copy information from one cell to another .. but if the source cell (or is it the destination cell ?) is blank after attempting to copy .. delete the row the cell is located in ?


You will need to describe your needs in a clearer manner.
 
Upvote 0
Sorry I need A VBA that will hide rows if column U, V and W has a blank cell in them.
 
Upvote 0
.
Here's a sample macro you can start with. Of course the range will need editing.

Code:
Option Explicit


Sub DoIfNotEmpty()
    Dim ra As Range, re As Range


    With ThisWorkbook.Worksheets("Sheet1")
    Set ra = .Range("B2:B10")
        For Each re In ra
            If IsEmpty(re.Value) Or re.Value = vbNullString Then
                Columns("B").EntireColumn.Hidden = True
            End If
        Next re
    End With
End Sub
 
Upvote 0
I need help can not get it to work right

Code:
 Sub DoIfNotEmpty()
    Dim ra As Range, re As Range

    With ThisWorkbook.Worksheets("Sheet1")
    Set ra = .Range("U2:W10")
        For Each re In ra
            If IsEmpty(re.Value) Or re.Value = vbNullString Then
                Rows("U", "V", "W").EntireColumn.Hidden = True
            End If
        Next re
    End With
End Sub
 
Upvote 0
.
Code:
Option Explicit


Sub DoIfNotEmpty()
    Dim ra As Range, re As Range


    With ThisWorkbook.Worksheets("Sheet1")
    Set ra = .Range("U2:W10")
        For Each re In ra
            If IsEmpty(re.Value) Or re.Value = vbNullString Then
                Columns("U:W").EntireColumn.Hidden = True
            End If
        Next re
    End With
End Sub
 
Upvote 0
Still can not get it right. If I have blink space in U2 and V4 and V6 and W7. I want it to hidden Rows 2,4,6 and 7.

code:[Option Explicit

Sub DoIfNotEmpty()
Dim ra As Range, re As Range

With ThisWorkbook.Worksheets("Sheet1")
Set ra = .Range("U2:W10")
For Each re In ra
If IsEmpty(re.Value) Or re.Value = vbNullString Then
Rows("U:W").EntireRow.Hidden = True
End If
Next re
End With
End Sub ]/ code
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top