Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Macro to insert this formula automatically on start up

I need an excel sheet to automatically run a macro on click command, so
that this formula

=Sheet3!A1&""

is inserted in all cells in the worksheet.


Please advise on how i can go about doing this.

Cheers!
Sunny

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Macro to insert this formula automatically on start up

Sorry. My subject says run on start up...I am okay with either a click
command or running on start up. All it needs to do is insert formula in
the sheet

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Macro to insert this formula automatically on start up

To fill ALL cells in a worksheet would mean nearly 17 million formulas
- I tried it and ran out of memory.

For a lesser reange of cells, however, use this:

(Ignore the text wrapping)

Private Sub Workbook_NewSheet(ByVal Sh As Object) 'Change to whichever
event is best

ActiveSheet.Range("A1:C20").Formula = "=Sheet3!$A$1&" & Chr(34) &
Chr(34)

End Sub

If you want the references to be relative, remove the $ signs.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Macro to insert this formula automatically on start up

Hi Sunny,

Try assigning the following code to a button from the Forms toolbar:


Public Sub Tester()
ActiveSheet.UsedRange.Formula = "=Sheet3!A1&"""""
End Sub


---
Regards,
Norman



wrote in message
ups.com...
I need an excel sheet to automatically run a macro on click command, so
that this formula

=Sheet3!A1&""

is inserted in all cells in the worksheet.


Please advise on how i can go about doing this.

Cheers!
Sunny



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default Macro to insert this formula automatically on start up

I am really curious as to why you would want to do this whether
it involves the entire worksheet (impossible), the used range,
or even a large chunk of cells.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

wrote in message ups.com...
I need an excel sheet to automatically run a macro on click command, so
that this formula

=Sheet3!A1&""

is inserted in all cells in the worksheet.


Please advise on how i can go about doing this.

Cheers!
Sunny





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Macro to insert this formula automatically on start up

I tried doing it to the complete worksheet. Not possible -ran out of
memory. Then I did it for a range..works fine..Why I need it, is
because I export from Access, multiple tables, which can only paste as
new worksheets...I already have an existing worksheet with graphs which
needs to pull data from there...so, I have linked the source for graphs
to that existing worksheet, and written a macro to that existing sheet
to copy from the new sheet that has been exported to excel...

I don't think i am clear enough...let me know if you understood what i
am trying...the number of records may sometimes exceed 50000, so i may
need to do this manually by copying

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default Macro to insert this formula automatically on start up

No I don't understand. What does having a sheetfull
of the same values get you that one cell with the
value does not. Why do you even need the sheet.

wrote in message
I don't think i am clear enough...let me know if you understood what i
am trying...the number of records may sometimes exceed 50000, so i may
need to do this manually by copying



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Macro to insert this formula automatically on start up

I am looking at automating a report, so i have cells that are
referenced to a sheet with a specific name "DUMP" . Access is unable
to export data to that specific sheet, so it creates a new sheet called
DUMP1 everytime..What i need to do is put a macro, which i can execute
from access immediately after the export, so that the sheet DUMP gets
populated with all the data on DUMP1 (sheet that just came in from
access), so that the formula reference works fine.

I cannot put formula reference to sheet DUMP1, because the DUMP1 doesnt
exist, but only is created when exported. When the sheet doesnt exist,
the formula changes to #REF error.

I tried a macro and it works fine, except in cases of large chunks of
data...Maybe i will try a macro which inserts the formula in the
specific cells mentioned...
Can you please help me, as to how a macro can be asked to paste a
formula on different range of cells in a sheet, like from C1:C20 and
C25:C40 and so on..

Cheers!

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Macro to insert this formula automatically on start up

David,

Another question, how do i just copy the used range?

Regards
Sunny

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
macro to automatically insert static time in a cell Bill Excel Worksheet Functions 7 June 10th 08 12:14 AM
how do i automatically insert a file name into a formula from a ta AMabin Excel Discussion (Misc queries) 2 February 27th 07 06:53 PM
Automatically Insert Text Into Macro Carl Bowman Excel Programming 7 February 12th 05 11:45 PM
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet? oil_driller Excel Discussion (Misc queries) 1 February 8th 05 09:34 AM
Can I automatically start a macro if the contents of a particular cell change markshowell Excel Programming 1 March 2nd 04 07:29 PM


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