View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
p45cal[_222_] p45cal[_222_] is offline
external usenet poster
 
Posts: 2
Default exporting specific cell(s)/ range

Right, tested this time (there were other problems):
Code:
Sub ClickAdd()
Dim rngAvailable As Range, rngCell As Range
If Range("F4") = "y" Then 'case sensitive
  Set rngAvailable = ThisWorkbook.Worksheets("Sheet1").Range("B18:B40")
  For Each cll In Range("A4:C4,I4:Q4").Cells
    If Application.WorksheetFunction.CountIf(rngAvailable, cll.Value) = 0 Then
      If Application.WorksheetFunction.CountBlank(rngAvailable)  0 Then
        rngAvailable.SpecialCells(xlCellTypeBlanks)(1) = cll.Value
      Else
        MsgBox "Ran outta spaces... couldn't place " & cll.Value & " from " & cll.Address & vbLf & "Stopping.", 0, ""
        Exit Sub
      End If
    End If
  Next cll
End If
End Sub
This is case sensitive for the 'y' in F4 but case insensitive for the strings being copied.

---
frmsrcurl: http://msgroups.net/microsoft.public...c-cell-s-range