Does this do it? (untested):
Code:
--------------------
Sub ClickAdd()
Dim rngAvailable As Range, rngCell As Range, bolSuccess As Boolean
If Range("F4") = "y" Then
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
For Each rngCell In rngAvailable
If rngCell.Value = vbNullString Then
rngCell.Value = cll.Value
bolSuccess = True
Exit For
End If
Next
If Not bolSuccess Then
MsgBox "Ran outta spaces... couln't place " & cll.Value & " from " & cll.Address, 0, ""
End If
Next cll
End If
End If
End Sub
--------------------
James;608919 Wrote:
right now this code exports to another sheet, and only exports the
active
cell. I would like to export a given cell range in a row (A4:C4,
F4,I4:Q4),
with a comfirmation based on F4 being "y" vs "n".
Sub ClickAdd()
Dim rngAvailable As Range, rngCell As Range, bolSuccess As Boolean
Set rngAvailable = ThisWorkbook.Worksheets("Sheet1").Range("B18:B40")
'Range Of Cells that needs to change'
For Each rngCell In rngAvailable
If rngCell.Value = vbNullString Then
rngCell.Value = ActiveCell.Value
bolSuccess = True
Exit For
End If
Next
If Not bolSuccess Then
MsgBox "Ran outta spaces...", 0, ""
End If
is there also a way to verify if a given name has already been
exported?
--
p45cal
*p45cal*
------------------------------------------------------------------------
p45cal's Profile: 558
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=169024
Microsoft Office Help