Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Pasting an unknown range



Hello all,

I am working on a macro that will analyze all of my formulas on the
activesheet and when it finds a formula that meets it criteria it will
copy the formula and past it into another worksheet. The macro is
working accept for the fact that I can not get it to past the formula
where I want it to. I want it to past it into the same cell reference
in a different worksheet (i.e. cell C6 in sheet 3 to cell C6 in new
sheet.). Since the reference cells are unknown I can not hard code it.
Any help would be GREATLY appreciated.


NMD

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Pasting an unknown range

IF you are using FIND then:

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row & "," & c.Column <== row & column you need
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress

End If
End With

HTH

(If not, post sample of your code)

"nmd030583" wrote:



Hello all,

I am working on a macro that will analyze all of my formulas on the
activesheet and when it finds a formula that meets it criteria it will
copy the formula and past it into another worksheet. The macro is
working accept for the fact that I can not get it to past the formula
where I want it to. I want it to past it into the same cell reference
in a different worksheet (i.e. cell C6 in sheet 3 to cell C6 in new
sheet.). Since the reference cells are unknown I can not hard code it.
Any help would be GREATLY appreciated.


NMD


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Pasting an unknown range

HTH

Thanks for your quick reply. Below is my code (I should have posted
this the first time sorry). I am just not shure where to tell it to
paste to. Thank you.

NMD



Sub FindTheNumbersInFormulas()
Dim lngN As Long
Dim rngAll As Excel.Range
Dim rngCell As Excel.Range
Dim strForm As String
Dim strPart As String

Set rngAll = ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormu las)
Application.ScreenUpdating = True
Application.CutCopyMode = False
For Each rngCell In rngAll
strForm = rngCell.Formula
For lngN = 1 To Len(strForm)
strPart = Mid$(strForm, lngN, 2)
If strPart Like "+#" Or strPart Like "-#" Then
rngCell.Select
Selection.Copy
Sheets("consant map").Select
ActiveSheet.Paste
Sheets("Sheet6").Select
Exit For
End If
Next 'lngN
Next 'rngCell
Application.ScreenUpdating = True
Set rngAll = Nothing
Set rngCell = Nothing
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Pasting an unknown range

Supposed you want to paste the formula in the active cell:
Worksheets("newsheetname").Cells(ActiveCell.Row, ActiveCell.Column).Formula
= ActiveCell.Formula


Regards,
Stefi

€žnmd030583€ť ezt Ă*rta:



Hello all,

I am working on a macro that will analyze all of my formulas on the
activesheet and when it finds a formula that meets it criteria it will
copy the formula and past it into another worksheet. The macro is
working accept for the fact that I can not get it to past the formula
where I want it to. I want it to past it into the same cell reference
in a different worksheet (i.e. cell C6 in sheet 3 to cell C6 in new
sheet.). Since the reference cells are unknown I can not hard code it.
Any help would be GREATLY appreciated.


NMD


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
Unknown Range in Macro scone57 Excel Discussion (Misc queries) 7 February 5th 09 03:33 PM
Counting an Unknown Range atryon Excel Discussion (Misc queries) 1 May 5th 08 08:44 PM
sorting unknown range peyman Excel Discussion (Misc queries) 10 October 20th 07 08:34 PM
HELP! Unknown range Excel_Oz Excel Worksheet Functions 3 March 16th 07 01:35 AM
Average of Unknown Range Mike Excel Discussion (Misc queries) 9 March 24th 06 03:37 PM


All times are GMT +1. The time now is 11:24 AM.

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"