Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
pol pol is offline
external usenet poster
 
Posts: 129
Default Please help to to derive a formula

I have the following formula

Dim res As Variant
res = ActiveCell.Address
With ActiveSheet
lastrow = .Cells(.Rows.Count, "G").End(xlUp).Row
.Range(res & ":M" & lastrow).FormulaR1C1 = .Range(res).FormulaR1C1
End With

Suppose the value of the res is "M$7". Please help to remove the hardcoding
from the formula
.Range(res & ":M" & lastrow).FormulaR1C1 = .Range(res).FormulaR1C1

I have to remove ":M" , and should be use the fist digit of the res. Please
help

With thanks
Pol

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Please help to to derive a formula

Maybe...

Option Explicit
Sub testme()
Dim myCell As Range
Dim LastRow As Long

Set myCell = ActiveCell

With ActiveSheet
LastRow = .Cells(.Rows.Count, "G").End(xlUp).Row
.Range(myCell, .Cells(LastRow, myCell.Column)).FormulaR1C1 _
= myCell.FormulaR1C1
End With

End Sub



pol wrote:

I have the following formula

Dim res As Variant
res = ActiveCell.Address
With ActiveSheet
lastrow = .Cells(.Rows.Count, "G").End(xlUp).Row
.Range(res & ":M" & lastrow).FormulaR1C1 = .Range(res).FormulaR1C1
End With

Suppose the value of the res is "M$7". Please help to remove the hardcoding
from the formula
.Range(res & ":M" & lastrow).FormulaR1C1 = .Range(res).FormulaR1C1

I have to remove ":M" , and should be use the fist digit of the res. Please
help

With thanks
Pol


--

Dave Peterson
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
Derive Average ryguy7272 Excel Worksheet Functions 5 May 13th 09 01:37 PM
Formula to derive "Year-To_Date" Vince Excel Discussion (Misc queries) 6 December 1st 08 06:11 PM
What formulae to derive? Jeffrey Excel Worksheet Functions 1 May 4th 07 12:42 AM
Need to derive combinations for 4 elements each with 3 possible va LAdekoya Excel Worksheet Functions 4 November 8th 05 12:26 PM
Using on one list derive from another mikeyts New Users to Excel 5 December 16th 04 06:26 AM


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