title: Update a range if the source cell is not blank, otherwise skip to next
body: <p>I can't seem to figure out one condition of my code.  I'm also a beginner at VBA. In short, I have a slicer on one worksheet that contains my filter values, and I have a range of 19 cells that can be updated with a drop down list I setup using data validation.</p>
  
  <p>When a value is selected in ANY cell of the range on the source worksheet (source range is M8:M26), I need it to update the corresponding cell in a range of another workbook (which is not a continuous range like in the source workbook).  For example, M8 will update AB335 when the filter is on desk1, M9 will update AB358, etc...  I'm having the most trouble figuring out how to loop the update so if the first cell in the source range is blank, skip to the next and continue with the updates. </p>
  
  <p>If the cell is blank, I also don't want it to override the destination range cell with a blank value, and so far that seems to work with my code.  I just can't get it to update if the values are updated in a random order on the source range.  Weird caveat is if I enter all of the values without skipping a cell, it will update fine.  How can I figure out how to move to the next cell and continue with the update if the previous cell had no selection?  Here's what I have for code so far: </p>
  
  <pre><code>      Sub UpdateRisk_Click()
  Dim wksSource As Worksheet, wksDest As Worksheet
  Dim strArray(0 To 18)    As String
  Dim Arng            As Range
  Dim Brng            As Range
  Dim cell            As Range
  Dim counter         As Long
  
  Set wksSource = ActiveWorkbook.Sheets("By Risk Pivot")
  Set wksDest = ActiveWorkbook.Sheets("(NEW) Full Data")
  Set Arng = wksDest.Range("AB335,AB358,AB379,AB380,AB382,AB383,AB386,AB391,AB404,AB409,AB410,AB412,AB413,AB423,AB427,AB432,AB438,AB442,AB443,AB444")
  Set Brng = wksDest.Range("AB109,AB130,AB151,AB152,AB155,AB157,AB159,AB166,AB178,AB185,AB186,AB187,AB188,AB193,AB197,AB199,AB204,AB206,AB208,AB209")
  
  counter = 0
  
  strArray(0) = wksSource.Range("M8")
  strArray(1) = wksSource.Range("M9")
  strArray(2) = wksSource.Range("M10")
  strArray(3) = wksSource.Range("M11")
  strArray(4) = wksSource.Range("M12")
  strArray(5) = wksSource.Range("M13")
  strArray(6) = wksSource.Range("M14")
  strArray(7) = wksSource.Range("M15")
  strArray(8) = wksSource.Range("M16")
  strArray(9) = wksSource.Range("M17")
  strArray(10) = wksSource.Range("M18")
  strArray(11) = wksSource.Range("M19")
  strArray(12) = wksSource.Range("M20")
  strArray(13) = wksSource.Range("M21")
  strArray(14) = wksSource.Range("M22")
  strArray(15) = wksSource.Range("M23")
  strArray(16) = wksSource.Range("M24")
  strArray(17) = wksSource.Range("M25")
  strArray(18) = wksSource.Range("M26")
  
  For Each cell In Arng
      If (strArray(counter) &lt;&gt; "") And (ActiveWorkbook.SlicerCaches("Slicer_Global_Desk1").SlicerItems("desk1").Selected = True) Then
          cell.Value = strArray(counter)
          counter = counter + 1
     End If
  Next cell
  
  For Each cell In Brng
  If Not (strArray(counter) = "") And (ActiveWorkbook.SlicerCaches("Slicer_Global_Desk1").SlicerItems("desk2").Selected = True) Then
      cell.Value = strArray(counter)
      counter = counter + 1
  End If
  Next cell
  
  Call PivotTableRefresh
  
  MsgBox "Updated Successfully"
  End Sub
  </code></pre>