Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default reading a formula and pasting it

i would like my program below to read the cell entered, copy the FORMULA
enterinto it (ie. "=h91+h38/j34") and paste it on all the appropriate spread
sheets (those that have a 4 in the correct cell. it currently only copies the
VALUE in the cell entered...

Sub M15GoToBotRight_All()
On Error GoTo bob2
selected_cell = InputBox("Enter Destination cell")
Formula1 = MsgBox("Copy Formula?", vbYesNo + vbDefaultButton2, "Quick
fixin's")
If Formula1 = vbYes Then Range(selected_cell).Select
Formula2 = ActiveCell
For Each w In Application.Workbooks: w.Activate
If selected_cell < "" Then
If Range("Sheet1!as597") = 4 Then Range(selected_cell).Select
If Formula1 = vbYes Then ActiveCell = Formula2
Else
If Range("Sheet1!as597") = 4 Then Application.Run "M15GoToBotRight"
End If
Next w: ThisWorkbook.Activate
Exit Sub
bob2: MsgBox ("Enter a Column and Row (Ex: z45)")
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default reading a formula and pasting it

Hi Lawson

Try changing the line Formula2 = activecell to
Formula2 = Activecell.Formula
then the line that says if Formula1 = vbyes then activecell = Formula2
to If Formula1 =vbyes then Activecell.formula = Formula2

regards,
Mike

"lawson" wrote:

i would like my program below to read the cell entered, copy the FORMULA
enterinto it (ie. "=h91+h38/j34") and paste it on all the appropriate spread
sheets (those that have a 4 in the correct cell. it currently only copies the
VALUE in the cell entered...

Sub M15GoToBotRight_All()
On Error GoTo bob2
selected_cell = InputBox("Enter Destination cell")
Formula1 = MsgBox("Copy Formula?", vbYesNo + vbDefaultButton2, "Quick
fixin's")
If Formula1 = vbYes Then Range(selected_cell).Select
Formula2 = ActiveCell
For Each w In Application.Workbooks: w.Activate
If selected_cell < "" Then
If Range("Sheet1!as597") = 4 Then Range(selected_cell).Select
If Formula1 = vbYes Then ActiveCell = Formula2
Else
If Range("Sheet1!as597") = 4 Then Application.Run "M15GoToBotRight"
End If
Next w: ThisWorkbook.Activate
Exit Sub
bob2: MsgBox ("Enter a Column and Row (Ex: z45)")
End Sub

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
Excel is reading formula as a value Louise[_3_] Excel Worksheet Functions 3 April 9th 10 05:48 PM
Help Reading Formula - Again! Kell2604 Excel Discussion (Misc queries) 5 November 11th 08 08:04 PM
Reading a formula Kell2604 Excel Discussion (Misc queries) 5 November 4th 08 10:43 PM
Formula reading formula instead of cell content roy.okinawa Excel Worksheet Functions 1 November 29th 05 03:20 AM
reading from another file and pasting to current file, "combobox" Darius New Users to Excel 1 September 26th 05 07:13 AM


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