Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Take value from active cell to make formula

What I sent does that without hitting the button...

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sjaakve" wrote in message
...
Thanks for all the efforts,

I was thinking about something like this.

1 - type "4" in to a cell, can be any cell.
2 - hit a button, or a keystroke
3 - "4" changes into "=OFFSET(MAT!A1;4,1)" , where the 4 in the
formule is the 4 i've typed before starting the macro.

Is this possible?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Take value from active cell to make formula

Ok, it took me while to figure out how the sent macro works. Thans
again.

I got it to work. It works ok, but i wanted it to work with a button.
I have to change numbers in that sheet all the time. The restriction
would be to large for the macro the save time.

like this:
1 - type "4" in to a cell, can be any cell.
2 - hit a button, or a keystroke
3 - "4" changes into "=OFFSET(MAT!A1;4,1)" , where the 4 in the
formule is the 4 i've typed before starting the macro.

i've tried to rewrite your macro but i can't get it to work.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Take value from active cell to make formula

works beautifully,

thanx.

I made some changes of my own. Took me all day to do that. posted
below.

Sub Lan()
Dim offset As Integer
For Each c In Selection
c.Select
ActiveCell.Select
If IsNumeric(ActiveCell.Value) Then
offset = ActiveCell.Value
ActiveCell = "=PROPER(OFFSET(LAN!A1," & offset & ",B1))"
With Selection.Interior
.Color = 5296274
End With
End If
Next c
End Sub

Now the macro work when multiple cells are selected, and when selected
cells are merged.

Hope you like it.

grts,

Sjaak
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Take value from active cell to make formula

Try this instead where the only selection is the range to change.
Change interior color index number to suit.

Sub chnagefrombuttonmultiple()
Dim c As Range
For Each c In Selection ' or range("a2:a6") for NO selection
If IsNumeric(c) Then
c.Formula = "=offset(lan!a1," & c.value & ",b1)"
c.Interior.ColorIndex = 3
End If
Next c
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sjaakve" wrote in message
...
works beautifully,

thanx.

I made some changes of my own. Took me all day to do that. posted
below.

Sub Lan()
Dim offset As Integer
For Each c In Selection
c.Select
ActiveCell.Select
If IsNumeric(ActiveCell.Value) Then
offset = ActiveCell.Value
ActiveCell = "=PROPER(OFFSET(LAN!A1," & offset & ",B1))"
With Selection.Interior
.Color = 5296274
End With
End If
Next c
End Sub

Now the macro work when multiple cells are selected, and when selected
cells are merged.

Hope you like it.

grts,

Sjaak


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
make cell active in beginning of macro Pam Excel Programming 6 October 8th 07 01:10 AM
Make the next cell active [email protected] Excel Programming 3 March 28th 06 06:56 PM
find text in a cell and make cell 2 cells below that active shark102 Excel Programming 4 October 20th 05 02:41 PM
How to make a particula cell ACTIVE using C# Srini Excel Programming 0 September 12th 05 05:34 PM
Make a particular cell the active one Newbie Excel Programming 3 April 14th 04 04:52 PM


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

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

About Us

"It's about Microsoft Excel"