ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code Problem (https://www.excelbanter.com/excel-programming/295320-code-problem.html)

Todd huttenstine

Code Problem
 
Hey guys

I cannot get the below code to work. The variable
Location currently has a value of $A$7.

Dim Location

Location = Workbooks("Completed Followup Detail
CSS.XLS").Sheets("Followup Summary").Range("A7:A3000").Find
(FindRangeA).Address
ActiveCell.Value = Location.Offset(1, 2).Value

What I want to happen is for the value of the active cell
to become the value specified in the code. For instance
currently the variable value is $A$7. I want the active
cells value to become the value of cell C8. I get this by
using my offset formula.

Instead of getting this, no value at all is being inserted.

How do I fix this?
Thanx
Todd

Todd huttenstine

Code Problem
 
Actually I figured it out. I changed the code to...
Sheets("Followup Summary").Range(Location).Offset(1,
2).Value


-----Original Message-----
Hey guys

I cannot get the below code to work. The variable
Location currently has a value of $A$7.

Dim Location

Location = Workbooks("Completed Followup Detail
CSS.XLS").Sheets("Followup Summary").Range

("A7:A3000").Find
(FindRangeA).Address
ActiveCell.Value = Location.Offset(1, 2).Value

What I want to happen is for the value of the active cell
to become the value specified in the code. For instance
currently the variable value is $A$7. I want the active
cells value to become the value of cell C8. I get this

by
using my offset formula.

Instead of getting this, no value at all is being

inserted.

How do I fix this?
Thanx
Todd
.


Chris

Code Problem
 
because Location is a String Not a Range object, the .address property returns a string
and the Offset method requires a Range object. The Find method returns a Range Object, but its looking for the range (or cell) where the string "$A$7" is. You need to convert $A$7 to a range

----- Todd Huttenstine wrote: ----

Hey guy

I cannot get the below code to work. The variable
Location currently has a value of $A$7

Dim Locatio

Location = Workbooks("Completed Followup Detail
CSS.XLS").Sheets("Followup Summary").Range("A7:A3000").Fin
(FindRangeA).Addres
ActiveCell.Value = Location.Offset(1, 2).Valu

What I want to happen is for the value of the active cell
to become the value specified in the code. For instance
currently the variable value is $A$7. I want the active
cells value to become the value of cell C8. I get this by
using my offset formula

Instead of getting this, no value at all is being inserted

How do I fix this
Than
Tod


Tom Ogilvy

Code Problem
 
The Find method returns a Range Object, but its looking for the range (or
cell) where the string "$A$7" is. You need to convert $A$7 to a range.

if the variable location contains the string "$A$7"

and the first argument to Find is the variable findrangeA, then how is find
looking "for the range (or cell) where the string "$A$7" is" ?? And if it
were, how would the variable location get the value "$A$7"; cell A7 contains
the string "$A$7"?

--
Regards,
Tom Ogilvy



"chris" wrote in message
...
because Location is a String Not a Range object, the .address property

returns a string.
and the Offset method requires a Range object. The Find method returns a

Range Object, but its looking for the range (or cell) where the string
"$A$7" is. You need to convert $A$7 to a range.

----- Todd Huttenstine wrote: -----

Hey guys

I cannot get the below code to work. The variable
Location currently has a value of $A$7.

Dim Location

Location = Workbooks("Completed Followup Detail
CSS.XLS").Sheets("Followup Summary").Range("A7:A3000").Find
(FindRangeA).Address
ActiveCell.Value = Location.Offset(1, 2).Value

What I want to happen is for the value of the active cell
to become the value specified in the code. For instance
currently the variable value is $A$7. I want the active
cells value to become the value of cell C8. I get this by
using my offset formula.

Instead of getting this, no value at all is being inserted.

How do I fix this?
Thanx
Todd





All times are GMT +1. The time now is 06:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com