New at this...need help please.

  • Thread starter Thread starter luvsun27
  • Start date Start date
L

luvsun27

I am trying to create a macro to populate another worksheet. I did m
subtotals, but when I do a link from the subtotal page in the ne
document, it gives me a specific cell number...I want it to be dynami
and find the cell number.

For example, on the subtotal page, there are 3 columns and 3 rows fo
the totals...and I want to pull the total #1 without specifiying th
row "C2204". Is there a code/command that will do a find on a key wor
and then use the cell that is to the right or left of it?

Sorry so confusing....this is new to me. Thanks much
 
Sub FindSubTotal()
Dim rng As Range
Set rng = Cells.Find(What:="Subtotal", _
After:=Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
rng.Offset(0, 1).Select
Else
MsgBox "Subtotal not found"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top