Locating cells that start with certain letters - VBA code

jharvey_22

New Member
Joined
Jun 10, 2011
Messages
8
Here is my code:

Option Explicit
Dim i As Long
Dim j As Long
Dim x As Long
Dim PrevCalc
Sub Report4()
'Gather information from comparison tab and locate values where value is >100%. If data set contains
'values, we will record that in the report. Because we know i & j, we know where the value is located in
'the comparison tab. Using this information, we can locate the other information we want for the report.
With Application
.ScreenUpdating = False
.EnableEvents = False
PrevCalc = .Calculation
.Calculation = xlCalculationManual
End With
x = 0
For i = 0 To 202
For j = 0 To 58
If IsError(Worksheets("Comparison").Range("C19").Offset(i, j)) Then
Else
If (Worksheets("Comparison").Range("C19").Offset(i, j)) > 1 Then
x = x + 1
Range("percentagechange3").Offset(x - 1, 0) = Worksheets("Comparison").Range("C19:BH220").Offset(i, j).Value 'Value of the % change is reported here
Range("hfmnumber3start").Offset(x - 1, 0) = Worksheets("Comparison").Range("A19").Offset(i, 0) 'since we know the row where the error is, we can look up the HFM # in that row
Range("hfmaccount3start").Offset(x - 1, 0) = Worksheets("comparison").Range("B19").Offset(i, 0) 'since we know the row where the error is, we can look up the HFM account in that row
Range("location3start").Offset(x - 1, 0) = Worksheets("comparison").Range("c15").Offset(0, j) 'since we know the column where the error is, we can look up the entity in that row
End If
End If
Next j
Next i
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = PrevCalc
End With
End Sub

How can I change the code to look in worksheets("comparison").Range("A15") and run the code above to only cells that begin with the letters E and I. I am pretty new to VBA and need some help. I'm guessing this will go just after the Else in the code above. Thanks for any help!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,602
Messages
6,179,843
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top