Hey Guys!
Thought I would try my hand again at this VBA stuff....
Two parts, please see bellow for more....
Though I need some help, bellow is some code slightly modified tutorial, but I noticed that when I search for a part number with a dash it does not work, if there are no special characters it works fine, how can I fix this part of it?
[VBA]If Cell.Value Like "7441702242-M" Then[/VBA]
Here is all the code:
[VBA]
Option Explicit
Public Sub copyRows()
Dim SiteCol As Range, Cell As Object
Dim NewSh As Worksheet
Set SiteCol = Range("A:A") 'Range containing pc names
Set NewSh = Worksheets.Add
For Each Cell In SiteCol
If IsEmpty(Cell) Then
Exit Sub
End If
If Cell.Value Like "7441702242-M" Then
'If Cell.Value Like "PN" Then
Cell.EntireRow.Copy
ActiveSheet.Range("A10000").End(xlUp).Select
Selection.Offset(1, 0).Select
NewSh.Paste
Application.CutCopyMode = False
End If
Next
End Sub
[/VBA]
Second part:
Once I run the above code I need to run a second sub to create some totals; I am doing it this way because I really don't know what I am doing yet sorry!
My question is how can I run this code within the above code of can I call it to run, or should I make a function?? I tried embedding it into the above code but it would not run? Here is the Code:
[VBA]
Public Sub mSum()
Range("C23").Value = Application.WorksheetFunction.Sum(Range("C1:C23"))
Range("D23").Value = Application.WorksheetFunction.Sum(Range("D123"))
Range("E23").Value = Application.WorksheetFunction.Sum(Range("E1:E23"))
End Sub
[/VBA]
Thanks for any help with this.
Rob