Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba macro coding in excel

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi guys,

would anyone know how to do the following?

take a label in an active cell and then compare it to a specified range.
if the label is within the range then it will do nothing, else it would add it to the range

i cant seem to get this to work using nested if's so if anyone out there could help it would be much appreciated =]
 
This might help


'P1 points to the last entry in the userlist populated at startup (or whatever range you want)
dim entry_found as boolean
For i = 1 To Worksheets("CumSeries").Range("P1").Value
strRange = "" & "P" & (1 + i) & "" 'ignore P1
If Worksheets("Cumseries").Range(strRange).Value = yournewvalue Then
entry_found = true
exit for
End If
Next i

if not entry_found then
i = i + 1
strRange = "" & "P" & (1 + i) & ""
Worksheets("Cumseries").Range(strRange).Value = strUserID = yournewvalue
end if

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top