Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default Macro to edit cells

I have cells in a row with formulas that have the number 25 in them, such as, for example for two of them: =Project1!E25+... and =Project2!G25-....

I need to go to the cell and edit out everything that appears after (to the right of) the 25, then accept the revised formula as is. It's never more than, say, 20 more characters to the right, in case that matters. Can someone (carefully, please) write me a macro that will do this on the current cell, then move one cell to the right and repeat until it gets to the last column in that same row?

Thanks so much!
Dean
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Macro to edit cells

I'd try something like this:

Dim strFormula As String

Do Until ActiveCell.Value = ""
strFormula = ActiveCell.Formula
strFormula = Mid(strFormula, 1, InStr(1, strFormula, "25") + 1)
ActiveCell.Formula = strFormula
ActiveCell.Offset(0, 1).Select
Loop

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default Macro to edit cells

Wow, that was awesome!

Unfcfortunately, after doing a lot of custom edit replace setup stuff in a
worksheet, someone changed the specs on me, and so I am trying to find
quicker ways, via macro, to deal with this! And so I ask: One more please?

In the same row, as I move one cell to the right, across 12 * 20 = 240
columns from column L through IQ, all references are currently to the
Project 1 worksheet, but I would like it to be to Project 1 (in column L),
then project 2 (in column M), all the way through Project 20 (in column AE).
Then in the next column, column AF, I would like it to start with Project 1
again, then repeat for another block of 20 columns. Repeat until we've done
this a total of 12 times.

Hopefully, I can adapt this and the one you've given me earlier to do any
more by myself!

Thanks so much!
Dean


wrote in message
oups.com...
I'd try something like this:

Dim strFormula As String

Do Until ActiveCell.Value = ""
strFormula = ActiveCell.Formula
strFormula = Mid(strFormula, 1, InStr(1, strFormula, "25") + 1)
ActiveCell.Formula = strFormula
ActiveCell.Offset(0, 1).Select
Loop



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default Macro to edit cells

I got this solved now, thanks to JMB, so no need to do anything more. Thx.

Dean

"Dean" wrote in message
...
Wow, that was awesome!

Unfcfortunately, after doing a lot of custom edit replace setup stuff in a
worksheet, someone changed the specs on me, and so I am trying to find
quicker ways, via macro, to deal with this! And so I ask: One more
please?

In the same row, as I move one cell to the right, across 12 * 20 = 240
columns from column L through IQ, all references are currently to the
Project 1 worksheet, but I would like it to be to Project 1 (in column L),
then project 2 (in column M), all the way through Project 20 (in column
AE). Then in the next column, column AF, I would like it to start with
Project 1 again, then repeat for another block of 20 columns. Repeat
until we've done this a total of 12 times.

Hopefully, I can adapt this and the one you've given me earlier to do any
more by myself!

Thanks so much!
Dean


wrote in message
oups.com...
I'd try something like this:

Dim strFormula As String

Do Until ActiveCell.Value = ""
strFormula = ActiveCell.Formula
strFormula = Mid(strFormula, 1, InStr(1, strFormula, "25") + 1)
ActiveCell.Formula = strFormula
ActiveCell.Offset(0, 1).Select
Loop





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
Edit cut cells Joe[_14_] Excel Discussion (Misc queries) 1 June 16th 09 08:56 PM
Record Macro and Edit Macro options disabled Huzza New Users to Excel 1 March 18th 09 03:55 PM
how to edit cells Ralf Dieckmann New Users to Excel 2 April 14th 08 10:58 PM
How to use macro to edit data in Excel cells Annamalai Excel Discussion (Misc queries) 11 September 21st 06 07:44 AM
How do Macro to EDIT cells? George[_23_] Excel Programming 1 September 27th 04 02:35 PM


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