A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro to affect all sheets



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2010, 07:33 PM posted to microsoft.public.excel.misc
REMB
external usenet poster
 
Posts: 4
Default Macro to affect all sheets

I want to select all sheets in a workbook, insert a column, and put a formula
in that column. It works fine when doing it manually, but if I try to have a
macro do this, it only affects one sheet. Is there any way to do this?
  #2  
Old June 4th, 2010, 07:48 PM posted to microsoft.public.excel.misc
מיכאל (מיקי) אבידן
external usenet poster
 
Posts: 562
Default Macro to affect all sheets

The general principal is shown in the following code.
Pls note: the code places the formula: =2+2 in cell F1 of every sheet.
I'm sure it will b no problem 4 u yo change it 4 your needs.
-----------------------
Sub All_Sheets()
For Each SH In ActiveWorkbook.Sheets
SH.[F1].Formula = "=2+2"
Next
End Sub
-------------
Micky


"REMB" wrote:

I want to select all sheets in a workbook, insert a column, and put a formula
in that column. It works fine when doing it manually, but if I try to have a
macro do this, it only affects one sheet. Is there any way to do this?

  #3  
Old June 4th, 2010, 09:03 PM posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default Macro to affect all sheets


I know that it doesn't make sense but Excel will NOT accept all sheets in a
macro for this. Use the suggested loop. Fast
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"REMB" wrote in message
...
I want to select all sheets in a workbook, insert a column, and put a
formula
in that column. It works fine when doing it manually, but if I try to have
a
macro do this, it only affects one sheet. Is there any way to do this?


  #4  
Old June 4th, 2010, 09:45 PM posted to microsoft.public.excel.misc
njmikec
external usenet poster
 
Posts: 1
Default Macro to affect all sheets


REMB;958360 Wrote:
I want to select all sheets in a workbook, insert a column, and put a
formula
in that column. It works fine when doing it manually, but if I try to
have a
macro do this, it only affects one sheet. Is there any way to do this?

Have you tried recording the Macro on Sheet 1 first, then holding down
shift, and hilighting all tabs and running the Macro?




--
njmikec
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:33 AM.


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