Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Concatenate formula with relative cells

Hi All.......

I need a macro, if you please, that will put a Concatenation formula in the
active cell that will Concatenate the cell to the left of the active cell
and the three cells to the right of the active cell, with _underscore_
separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the macro, and
get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste special
Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works fine but
leaves the cell value as a formula if it was one to begin with). I would
like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Concatenate formula with relative cells

Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" & R[0]C4 &
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell, with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Concatenate formula with relative cells

CLR,

To make the hyperlink, select the cell and run this:

Sub TryNow()
With ActiveCell
.Value = .Offset(0, -1).Value & "_" & .Offset(0, 1).Value & _
"_" & .Offset(0, 2).Value & "_" & .Offset(0, 3).Value
ActiveSheet.Hyperlinks.Add anchor:=ActiveCell, Address:=.Value
End With
End Sub

HTH,
Bernie
MS Excel MVP

CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell, with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Concatenate formula with relative cells

Think Frank meant to post code like this:

Sub Tester2()
For i = 1 To 10
Cells(i, 6).FormulaR1C1 = "=RC[-1] & ""-"" & RC[1]" _
& "& ""-"" & RC[2] & ""-"" & RC[3]"
Cells(i, 6).Value = Cells(i, 6).Value 'to convert to a value
Next i

End Sub

--
Regards,
Tom Ogilvy

"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" & R[0]C4 &
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell, with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Concatenate formula with relative cells

Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm looking
for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro will insert
the concatenation formula of the cell to the left of that selection and the
three cells to the right of the selection, and then extract only the text
value of that formula to leave in the cell, so my existing macro can turn
that text value into a link. No other cells are to be affected, only the
selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" & R[0]C4 &
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell, with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Concatenate formula with relative cells

Hi
in this case you could try (using Tom's corection - thanks for that)

with activecell.offset(0,-1)
.FormulaR1C1 = "=RC[2] & ""-"" & RC[3]" _
& "& ""-"" & RC[4]"
.Value = .Value 'to convert to a value
end with


--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm
looking for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro will
insert the concatenation formula of the cell to the left of that
selection and the three cells to the right of the selection, and then
extract only the text value of that formula to leave in the cell, so
my existing macro can turn that text value into a link. No other
cells are to be affected, only the selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" &
R[0]C4 & ""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation
formula in the active cell that will Concatenate the cell to the
left of the active cell and the three cells to the right of the
active cell, with _underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the
macro, and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Concatenate formula with relative cells

Think Frank was just demonstrating the concept - not offering a turnkey
solution.
Sub Tester2()
ActiveCell.FormulaR1C1 = "=RC[-1] & ""-"" & RC[1]" _
& "& ""-"" & RC[2] & ""-"" & RC[3]"
ActiveCell.Formula = ActiveCell.Value
End Sub

--
Regards,
Tom Ogilvy

"CLR" wrote in message
...
Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm looking
for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro will

insert
the concatenation formula of the cell to the left of that selection and

the
three cells to the right of the selection, and then extract only the text
value of that formula to leave in the cell, so my existing macro can turn
that text value into a link. No other cells are to be affected, only the
selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" & R[0]C4 &
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell, with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Concatenate formula with relative cells

Did you try this, which incorporates your macro?

Sub TryNow()
With ActiveCell
.Value = .Offset(0, -1).Value & "_" & .Offset(0, 1).Value & _
"_" & .Offset(0, 2).Value & "_" & .Offset(0, 3).Value
ActiveSheet.Hyperlinks.Add anchor:=ActiveCell, Address:=.Value
End With
End Sub

HTH,
Bernie
MS Excel MVP

"CLR" wrote in message
...
Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm looking
for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro will

insert
the concatenation formula of the cell to the left of that selection and

the
three cells to the right of the selection, and then extract only the text
value of that formula to leave in the cell, so my existing macro can turn
that text value into a link. No other cells are to be affected, only the
selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" & R[0]C4 &
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell, with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Concatenate formula with relative cells

Thanks Bernie..........

I'm a little slow, and actualy wanted to include some additional text in the
final Concatenation, but finally muddled through it and your solution worked
perfectly!!!.......

This is what I wound up with, which is just a tweaking of what you gave me
but with my added text.

Sub ConcatenateLink()
With ActiveCell
.Value = "\\Surfer\Approved Drawings\" & .Offset(0, -1).Value & "_Rev" &
..Offset(0, 1).Value & _
"_" & .Offset(0, 2).Value & "of" & .Offset(0, 3).Value & ".dwg"
ActiveSheet.Hyperlinks.Add anchor:=ActiveCell, Address:=.Value
End With
End Sub


Many, many thanks to you, and to all you guys for your offerings.........the
time and effort you guys put into answering these posts are really
appreciated.

Vaya con Dios,
Chuck, CABGx3




"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Did you try this, which incorporates your macro?

Sub TryNow()
With ActiveCell
.Value = .Offset(0, -1).Value & "_" & .Offset(0, 1).Value & _
"_" & .Offset(0, 2).Value & "_" & .Offset(0, 3).Value
ActiveSheet.Hyperlinks.Add anchor:=ActiveCell, Address:=.Value
End With
End Sub

HTH,
Bernie
MS Excel MVP

"CLR" wrote in message
...
Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm looking
for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro will

insert
the concatenation formula of the cell to the left of that selection and

the
three cells to the right of the selection, and then extract only the

text
value of that formula to leave in the cell, so my existing macro can

turn
that text value into a link. No other cells are to be affected, only

the
selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" & R[0]C4

&
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation

formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell,

with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the

macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3







  #10   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Concatenate formula with relative cells

Hi Bernie...........

Just had to thank you again for that nifty macro. I went ahead and used it
the rest of the day yesterday , and believe it or not, I estimate it saved
me more than 25 minutes in just that part of the day!!!

It's really amazing how some little macro like that can consolidate so many
manual steps and significantly improve a persons productivity. And, not
only that, by not having to "switch off" to that train of thinking, I am
able to stay more focused on my larger problems..........immesurable
benefits!

Thanks ever so much again and again............

Vaya con Dios,
Chuck, CABGx3


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Did you try this, which incorporates your macro?

Sub TryNow()
With ActiveCell
.Value = .Offset(0, -1).Value & "_" & .Offset(0, 1).Value & _
"_" & .Offset(0, 2).Value & "_" & .Offset(0, 3).Value
ActiveSheet.Hyperlinks.Add anchor:=ActiveCell, Address:=.Value
End With
End Sub

HTH,
Bernie
MS Excel MVP

"CLR" wrote in message
...
Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm looking
for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro will

insert
the concatenation formula of the cell to the left of that selection and

the
three cells to the right of the selection, and then extract only the

text
value of that formula to leave in the cell, so my existing macro can

turn
that text value into a link. No other cells are to be affected, only

the
selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" & R[0]C4

&
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation

formula
in the active cell that will Concatenate the cell to the left of the
active cell and the three cells to the right of the active cell,

with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the

macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3









  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Concatenate formula with relative cells

Chuck,

Glad to hear it, and you're quite welcome. My main Excel application saves
me - truthfully - weeks of time each time I need to use it, compared to what
I used to have to do 15 years ago <vbg

When you reach weeks of time saved, you can sign over a paycheck or two ;-)

Bernie

"CLR" wrote in message
Just had to thank you again for that nifty macro. I went ahead and used

it
the rest of the day yesterday , and believe it or not, I estimate it saved
me more than 25 minutes in just that part of the day!!!



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Concatenate formula with relative cells

You might also want to look up the Hyperlink worksheet function.

--
Regards,
Tom Ogilvy

"CLR" wrote in message
...
Hi Bernie...........

Just had to thank you again for that nifty macro. I went ahead and used

it
the rest of the day yesterday , and believe it or not, I estimate it saved
me more than 25 minutes in just that part of the day!!!

It's really amazing how some little macro like that can consolidate so

many
manual steps and significantly improve a persons productivity. And, not
only that, by not having to "switch off" to that train of thinking, I am
able to stay more focused on my larger problems..........immesurable
benefits!

Thanks ever so much again and again............

Vaya con Dios,
Chuck, CABGx3


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Did you try this, which incorporates your macro?

Sub TryNow()
With ActiveCell
.Value = .Offset(0, -1).Value & "_" & .Offset(0, 1).Value & _
"_" & .Offset(0, 2).Value & "_" & .Offset(0, 3).Value
ActiveSheet.Hyperlinks.Add anchor:=ActiveCell, Address:=.Value
End With
End Sub

HTH,
Bernie
MS Excel MVP

"CLR" wrote in message
...
Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm

looking
for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro will

insert
the concatenation formula of the cell to the left of that selection

and
the
three cells to the right of the selection, and then extract only the

text
value of that formula to leave in the cell, so my existing macro can

turn
that text value into a link. No other cells are to be affected, only

the
selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" &

R[0]C4
&
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation

formula
in the active cell that will Concatenate the cell to the left of

the
active cell and the three cells to the right of the active cell,

with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I

get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the

macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it

works
fine but leaves the cell value as a formula if it was one to begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3









  #13   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Concatenate formula with relative cells

Okey doke.........I'll give it a look........thanks for the tip Tom........

Vaya con Dios,
Chuck, CABGx3



"Tom Ogilvy" wrote in message
...
You might also want to look up the Hyperlink worksheet function.

--
Regards,
Tom Ogilvy

"CLR" wrote in message
...
Hi Bernie...........

Just had to thank you again for that nifty macro. I went ahead and used

it
the rest of the day yesterday , and believe it or not, I estimate it

saved
me more than 25 minutes in just that part of the day!!!

It's really amazing how some little macro like that can consolidate so

many
manual steps and significantly improve a persons productivity. And, not
only that, by not having to "switch off" to that train of thinking, I am
able to stay more focused on my larger problems..........immesurable
benefits!

Thanks ever so much again and again............

Vaya con Dios,
Chuck, CABGx3


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Did you try this, which incorporates your macro?

Sub TryNow()
With ActiveCell
.Value = .Offset(0, -1).Value & "_" & .Offset(0, 1).Value & _
"_" & .Offset(0, 2).Value & "_" & .Offset(0, 3).Value
ActiveSheet.Hyperlinks.Add anchor:=ActiveCell, Address:=.Value
End With
End Sub

HTH,
Bernie
MS Excel MVP

"CLR" wrote in message
...
Thanks Frank...........

That seems to be along the right lines, but not exactly what I'm

looking
for.......probably my explanation was insufficient.

I want to be able to highlight a cell, anywhere, and the macro

will
insert
the concatenation formula of the cell to the left of that selection

and
the
three cells to the right of the selection, and then extract only the

text
value of that formula to leave in the cell, so my existing macro can

turn
that text value into a link. No other cells are to be affected,

only
the
selected one.

Your code seems to treat F1:F10 all at once, regardless of where the
selected cell is.

TIA
Vaya conDios,
Chuck, CABGx3



"Frank Kabel" wrote in message
...
Hi
use the formulaR1C1 property. e.g.
if you enter the formula in column F try

for i = 1 to 10
cells(i,6).formular1c1="=R[0]C1 & ""-"" & R[0]C3 & ""-"" &

R[0]C4
&
""-"" & R[0]C5"
cells(i,6).value=cells(i,6).value 'to convert to a value
next i




--
Regards
Frank Kabel
Frankfurt, Germany


CLR wrote:
Hi All.......

I need a macro, if you please, that will put a Concatenation

formula
in the active cell that will Concatenate the cell to the left of

the
active cell and the three cells to the right of the active cell,

with
_underscore_ separations.

Like in B1 =A1&"_"&C1&"_"&D1&"_"&E1 except when I try it I

get
hardcoded cell addresses.

I want to be able to highlight any cell in the column, run the

macro,
and get the desired results from that row.

Then, I would like the result to be as though it was Copy

Paste
special Value (ie text only, no formula)

I then have a macro that will turn that text into a link, (it

works
fine but leaves the cell value as a formula if it was one to

begin
with). I would like to merge the two into one macro.

Sub makeLinks()
'Takes whatever text is in ActiveCell and turns it into a link
Dim lnk As String
lnk = ActiveCell.Text
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=lnk
End Sub



TIA
Vaya con Dios,
Chuck, CABGx3











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


Similar Threads
Thread Thread Starter Forum Replies Last Post
formula based on continuous relative cells bwilde Excel Discussion (Misc queries) 0 February 23rd 10 03:52 PM
Excel Formula using relative position of cells in two different worksheets David Virgil Hobbs Excel Discussion (Misc queries) 1 December 14th 06 03:36 AM
Excel Formula using relative position of cells in two different worksheets David Virgil Hobbs Excel Worksheet Functions 1 December 14th 06 03:36 AM
Relative cells in macro - and pasting a formula too! Excel Discussion (Misc queries) 3 February 23rd 06 02:46 PM
Can I concatenate text in cells to make a working formula? Matt S. R. Excel Discussion (Misc queries) 11 November 11th 05 03:44 PM


All times are GMT +1. The time now is 03:24 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"