R
Rich Cooper
I am trying to create a range. What i am doing is i have data that in
colums, A doctors last name in column a and first in column b. I have
figure out how to get the data like lastname, firstname. I have code that
tells me the last row and first row. For example it tells me that the first
row where there is an a as the first letter is 3, and the last row is 482.
I want to make rows 3-482 a range, but i can't figrue out how. Here is my
code:
Any help would be great.
Sub mg()
Dim Ridex As Long
Dim rng As Range, cell As Range
Dim LastRow As Integer, frow As Integer
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
rng.Offset(0, 35).Formula = "=trim(H1) & "", "" & trim(I1)"
rng.Offset(0, 35).Formula = rng.Offset(0, 35).Value
LastRow = Worksheets("demog").Cells(Rows.count, "AJ").End(xlUp).Row
For Ridex = 1 To LastRow
If UCase(Left(Cells(Ridex, "AJ").Value, 1)) = "A" Then
frow = Ridex
Exit For
End If
Next
End Sub
colums, A doctors last name in column a and first in column b. I have
figure out how to get the data like lastname, firstname. I have code that
tells me the last row and first row. For example it tells me that the first
row where there is an a as the first letter is 3, and the last row is 482.
I want to make rows 3-482 a range, but i can't figrue out how. Here is my
code:
Any help would be great.
Sub mg()
Dim Ridex As Long
Dim rng As Range, cell As Range
Dim LastRow As Integer, frow As Integer
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
rng.Offset(0, 35).Formula = "=trim(H1) & "", "" & trim(I1)"
rng.Offset(0, 35).Formula = rng.Offset(0, 35).Value
LastRow = Worksheets("demog").Cells(Rows.count, "AJ").End(xlUp).Row
For Ridex = 1 To LastRow
If UCase(Left(Cells(Ridex, "AJ").Value, 1)) = "A" Then
frow = Ridex
Exit For
End If
Next
End Sub