Stupid question - Put a value in a cell?

4

43fan

I'm running a routine that searches through an array to find a value. If it
finds it, it creates another routine that pastes certain values into another
sheet.

All I want to do is, if it finds those values, I want to put an "X" into
certain cells on another sheet. See, I said it was a stupid question. ;)
But, as a novice, it really has me stumped.

Thanks!
Shawn
 
4

43fan

Frank,

I can do that, no prob., in fact it'll be posted below. But, basically, how
to you just insert a value in a field?

Here's the code:(initially gotten from here, then modified) :)

Set Myrange = Intersect(ActiveSheet.UsedRange, Columns("B"))
If Myrange Is Nothing Then Exit Sub
Application.ScreenUpdating = False
FindRange = Array("MLAP")
For Each elem In FindRange
Set C = Myrange.Find(elem, Myrange.Cells(1), xlValues, xlPart)
If C Is Nothing Then Exit Sub
VehicleCell = "$A$" & Trim(Str(C.Row))
If Not C Is Nothing Then
If CopyRange Is Nothing Then Set CopyRange = Range(VehicleCell)
firstaddress = C.Address
Do
Set C = Myrange.FindNext(C)
VehicleCell = "$A$" & Trim(Str(C.Row))
Set CopyRange = Union(CopyRange, Range(VehicleCell))
Loop While firstaddress <> C.Address
End If
Next
Application.ScreenUpdating = True
If CopyRange Is Nothing Then Exit Sub
CopyRange.Copy

Sheets("Monday - Garage").Select
Range("A12").Select
ActiveSheet.Paste
Range("A26").Select
ActiveSheet.Paste

--------
This part all works fine and does what I want to do. Now that it's "found"
the values, I want to put an X in cells D12.... actually, just had another
thought. Since the values may be found in multiple cells throughout, I need
to put X's in multiple rows as well. There may be say 5 instances,
CopyRange has all five vehicle numbers in it, and gets pasted where it needs
to be. I guess what I need to do is somehow make CopyRange equal to the
vehicle number, plus the X's it needs? Can CopyRange be Vehicle number +
two empty cells, plus X, empty cell, then X, etc, etc.?

Not sure if I've explained this well or not, but I'm heading back to try
making CopyRange equal to everything I need. :)

Cells(D, 12) = "X"
 
F

Frank Kabel

Hi
to insert a value use something like
with range("B1")
.value="your_value"
end with
 
Top