Results 1 to 7 of 7

Macro - Ignore Cells with a value in?

Threaded View

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    34

    Macro - Ignore Cells with a value in?

    Hi there,

    I'm currently using a macro to determine what information is missing. However, the macro I'm using is overwriting all values. Is there anyway I can get it to ignore cells that have a value in? I've attached an example spreadsheet with the code I'm using.

    Below is the code I'm using:

    Sub Dave()
     Dim ws As Worksheet
     Dim rng As Variant
     Dim LR As Long
            Application.ScreenUpdating = 0
            
                Set ws = Worksheets("Sheet1")
                LR = ws.UsedRange.Rows.Count
                rng = ws.Range("A2:T" & LR).Value
                
                    With ws
                      .Cells(2, 2).Resize(LR).FormulaR1C1 = "=IF(RC[-1]<>"""",""Information Required"","""")"
                      .Cells(2, 3).Resize(LR).FormulaR1C1 = "=IF(RC[-2]<>"""",""Information Required"","""")"
                      .Cells(2, 4).Resize(LR).FormulaR1C1 = "=IF(RC[-3]<>"""",""Information Required"","""")"
                      .Cells(2, 5).Resize(LR).FormulaR1C1 = "=IF(RC[-4]<>"""",""Information Required"","""")"
                      .Cells(2, 6).Resize(LR).FormulaR1C1 = "=IF(RC[-5]<>"""",""Information Required"","""")"
                      .Cells(2, 7).Resize(LR).FormulaR1C1 = "=IF(RC[-6]<>"""",""Information Required"","""")"
                      .Cells(2, 8).Resize(LR).FormulaR1C1 = "=IF(RC[-7]<>"""",""Information Required"","""")"
                      .Cells(2, 9).Resize(LR).FormulaR1C1 = "=IF(RC[-8]<>"""",""Information Required"","""")"
                      .Cells(2, 10).Resize(LR).FormulaR1C1 = "=IF(RC[-9]<>"""",""Information Required"","""")"
                      .Cells(2, 11).Resize(LR).FormulaR1C1 = "=IF(RC[-10]<>"""",""Information Required"","""")"
                      .Cells(2, 12).Resize(LR).FormulaR1C1 = "=IF(RC[-11]<>"""",""Information Required"","""")"
                      .Cells(2, 13).Resize(LR).FormulaR1C1 = "=IF(RC[-12]<>"""",""Information Required"","""")"
                      .Cells(2, 14).Resize(LR).FormulaR1C1 = "=IF(RC[-13]<>"""",""Information Required"","""")"
                      .Cells(2, 15).Resize(LR).FormulaR1C1 = "=IF(RC[-14]<>"""",""Information Required"","""")"
                      .Cells(2, 16).Resize(LR).FormulaR1C1 = "=IF(RC[-15]<>"""",""Information Required"","""")"
                      .Cells(2, 17).Resize(LR).FormulaR1C1 = "=IF(RC[-16]<>"""",""Information Required"","""")"
                      .Cells(2, 18).Resize(LR).FormulaR1C1 = "=IF(RC[-17]<>"""",""Information Required"","""")"
                      .Cells(2, 19).Resize(LR).FormulaR1C1 = "=IF(RC[-18]<>"""",""Information Required"","""")"
                    End With
                ws.Range("A2:T" & LR).Value = ws.Range("A2:T" & LR).Value
                        With ws.Range("D2:T" & LR).Validation
                            .Delete
                            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
                            xlBetween, Formula1:="=$T$3:$T$8"
                            .IgnoreBlank = True
                            .InCellDropdown = True
                            .InputTitle = ""
                            .ErrorTitle = ""
                            .InputMessage = ""
                            .ErrorMessage = ""
                            .ShowInput = True
                            .ShowError = False
                        End With
            Application.ScreenUpdating = 1
    End Sub
    Thank you in advance for the help!
    Attached Files Attached Files
    Last edited by revenge4ash89; 12-09-2011 at 12:17 PM.

Thread Information

Users Browsing this Thread

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

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