bloodmilksky
Board Regular
- Joined
- Feb 3, 2016
- Messages
- 202
Hi Guys,
I am having trouble with the below code. it basically returns a range dependent on the users name going into cell B7.
I have amended the amount of information it returns (HL Below) and it is still returning the same range prior to me changing it.
I was just wondering if anycould help me please?
many thanks
jamie
I am having trouble with the below code. it basically returns a range dependent on the users name going into cell B7.
I have amended the amount of information it returns (HL Below) and it is still returning the same range prior to me changing it.
I was just wondering if anycould help me please?
many thanks
jamie
Code:
LastRowMenu = Sheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row + 1
LastRow = Sheets("Sheet8").Cells(Rows.Count, "B").End(xlUp).Row
If Not Intersect(Target, Range("B7")) Is Nothing Then
If Target.Value <> "" Then
FindString = UCase(Target.Value)
Set sRange = Sheets("Sheet8").UsedRange
For Each Cell In sRange
If InStr(1, UCase(Cell.Value), FindString) Then
[COLOR=#ff0000][B]Sheets("Sheet8").Range(Cell, Cell.Offset(34, 4)).Copy[/B][/COLOR]
Sheets("Sheet1").Range("B" & LastRowMenu).PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
' Draw in the gridlines
With Selection.Borders
.LineStyle = xlContinuous
.Weight = xlThin
End With
Selection.BorderAround Weight:=xlMedium
' Increase LastRowMenu by 8 to account for the new data
LastRowMenu = LastRowMenu + 8
End If
Next Cell..
If Range("F2:I36") = "" Then
' Display an error stating the name is not in the list
MsgBox "Specified name does not exist", vbOKOnly, "Attention!"
' Clear the contents of A1
Target.ClearContents
' Reselect cell A1
Range("B7").Select
End If
Else
' Clear the contents of Lenses section on the Menu sheet
Range("F2:I36" & LastRowMenu).ClearContents
End If
End If
End Sub