#1   Report Post  
Jeff
 
Posts: n/a
Default offset.cell

Hello,

I need help designing a VBA Macro: I have in cell A1 "Paid" in cell G8
"total" in cell H8 $100.00

What I need is: to cell.find "paid" then to do cell.offset to G8 to
select.copy the value in H8. Is this possible ?
Regards,

  #2   Report Post  
Dave O
 
Posts: n/a
Default

Minimally, the code looks like this:

Sub Copy_If_Paid()
If ActiveCell.Value = "Paid" Then
ActiveCell.Offset(0, 7).Copy
End If
End Sub

This works when the cell pointer is already on cell A1. A lot depends
on how your information is displayed on the spreadsheet. Do you have
many rows of Paid / Unpaid entries? Often I'll have a macro process
many rows in a spreadsheet, and I'll use a DO loop to repeat an
operation until it reaches the first blank row, or I enter the word
"Stop" when the data rows have ended.
What does your information look like?

Dave O

  #3   Report Post  
Jeff
 
Posts: n/a
Default

Thank you.
But I still need to offset the activecell to "Total" to select.copy the
value in H. Since I won't know how many rows there are between "Paid" "Total"
Regards,

"Dave O" wrote:

Minimally, the code looks like this:

Sub Copy_If_Paid()
If ActiveCell.Value = "Paid" Then
ActiveCell.Offset(0, 7).Copy
End If
End Sub

This works when the cell pointer is already on cell A1. A lot depends
on how your information is displayed on the spreadsheet. Do you have
many rows of Paid / Unpaid entries? Often I'll have a macro process
many rows in a spreadsheet, and I'll use a DO loop to repeat an
operation until it reaches the first blank row, or I enter the word
"Stop" when the data rows have ended.
What does your information look like?

Dave O


  #4   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
is your 'Total' label always in column G?

--
Regards
Frank Kabel
Frankfurt, Germany

Jeff wrote:
Hello,

I need help designing a VBA Macro: I have in cell A1 "Paid" in cell G8
"total" in cell H8 $100.00

What I need is: to cell.find "paid" then to do cell.offset to G8 to
select.copy the value in H8. Is this possible ?
Regards,



  #5   Report Post  
Jeff
 
Posts: n/a
Default

Total is always in column G and the value I need always in column H
Thanks,

"Frank Kabel" wrote:

Hi
is your 'Total' label always in column G?

--
Regards
Frank Kabel
Frankfurt, Germany

Jeff wrote:
Hello,

I need help designing a VBA Macro: I have in cell A1 "Paid" in cell G8
"total" in cell H8 $100.00

What I need is: to cell.find "paid" then to do cell.offset to G8 to
select.copy the value in H8. Is this possible ?
Regards,






  #6   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
one way in VBA

dim return_value
return_value=application.vlookup("Total",range("G: H"),2,0)
msgbox return_value

--
Regards
Frank Kabel
Frankfurt, Germany
"Jeff" schrieb im Newsbeitrag
...
Total is always in column G and the value I need always in column H
Thanks,

"Frank Kabel" wrote:

Hi
is your 'Total' label always in column G?

--
Regards
Frank Kabel
Frankfurt, Germany

Jeff wrote:
Hello,

I need help designing a VBA Macro: I have in cell A1 "Paid" in cell G8
"total" in cell H8 $100.00

What I need is: to cell.find "paid" then to do cell.offset to G8 to
select.copy the value in H8. Is this possible ?
Regards,






  #7   Report Post  
Jeff
 
Posts: n/a
Default

Thank you,
That's What I wanted, but I need first to do a cell.find in column A
for"paid" then I can do your macro.
Regards,


"Frank Kabel" wrote:

Hi
one way in VBA

dim return_value
return_value=application.vlookup("Total",range("G: H"),2,0)
msgbox return_value

--
Regards
Frank Kabel
Frankfurt, Germany
"Jeff" schrieb im Newsbeitrag
...
Total is always in column G and the value I need always in column H
Thanks,

"Frank Kabel" wrote:

Hi
is your 'Total' label always in column G?

--
Regards
Frank Kabel
Frankfurt, Germany

Jeff wrote:
Hello,

I need help designing a VBA Macro: I have in cell A1 "Paid" in cell G8
"total" in cell H8 $100.00

What I need is: to cell.find "paid" then to do cell.offset to G8 to
select.copy the value in H8. Is this possible ?
Regards,






  #8   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
why do you need this 'find' command first?

--
Regards
Frank Kabel
Frankfurt, Germany
"Jeff" schrieb im Newsbeitrag
...
Thank you,
That's What I wanted, but I need first to do a cell.find in column A
for"paid" then I can do your macro.
Regards,


"Frank Kabel" wrote:

Hi
one way in VBA

dim return_value
return_value=application.vlookup("Total",range("G: H"),2,0)
msgbox return_value

--
Regards
Frank Kabel
Frankfurt, Germany
"Jeff" schrieb im Newsbeitrag
...
Total is always in column G and the value I need always in column H
Thanks,

"Frank Kabel" wrote:

Hi
is your 'Total' label always in column G?

--
Regards
Frank Kabel
Frankfurt, Germany

Jeff wrote:
Hello,

I need help designing a VBA Macro: I have in cell A1 "Paid" in cell
G8
"total" in cell H8 $100.00

What I need is: to cell.find "paid" then to do cell.offset to G8 to
select.copy the value in H8. Is this possible ?
Regards,








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"