+ Reply to Thread
Results 1 to 8 of 8

Action not changing to General Format

  1. #1
    Registered User
    Join Date
    10-23-2006
    Posts
    79

    Action not changing to General Format

    Hi

    I have the following code that I need assistance with... (excuse my comments & long-winded way of writing code but I am only learning and require them in for the moment )

    Please Login or Register  to view this content.
    The problem is that the format of the columns to general to allow my formula to work is not happening...

    What am I doing wrong..?

    a very frustrated dugong! (aaaaarrrrrgggghhhhhh!!!!!!!!!!!!)

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    as you don't need to select the column to format it

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    10-23-2006
    Posts
    79
    Quote Originally Posted by VBA Noob
    Maybe change to
    Please Login or Register  to view this content.
    as you don't need to select the column to format it
    VBA Noob
    Hi VBA Noob,

    I tried what you suggested but then it bombs out at the
    "Cells(h, i + 1).FormulaR1C1 = "=SUM(RC[-(AddCols(g))]:RC[-1])""
    saying there is a runtime error 1004 - application-defined or object-defined error..

    If I dont have anything about changing the format to general, my loop does what I require but the formula goes in as text..!!!!!

    any other suggestions or ideas on how I can fix...?
    (thanks for looking BTW )

    dugong

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    The problem is caused by the use of With command as part of theformat command

    If you had used
    Please Login or Register  to view this content.
    Instead of
    Please Login or Register  to view this content.
    It would have worked

    VBA Noob
    Suggestion is a better way to go as it avoids selecting columns.
    Always avoid selecting & activing cells, columns, rows etc wherever possible

    If you use VBA Noobs suggestion you will also need to change

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please read forum rules below and wrap your code

    Thanks

    VBA Noob

  6. #6
    Registered User
    Join Date
    10-23-2006
    Posts
    79

    Unhappy

    Quote Originally Posted by VBA Noob
    Please read forum rules below and wrap your code
    Thanks
    VBA Noob
    I'm sorry I didn't realise I had to wrap it as it was the line already wrapped in code tags in the pre-entered post - Apologies VBA Noob.

    I have tried these two suggestions (thanks VBA Noob & Mudraker ) but it still bombs out. I think the problem may be that the formula is going in as actual text (rather than the formatting of it as text if that makes sense) - by this I mean, the Addcols(g) which may be a value of 4 is going in as
    Please Login or Register  to view this content.
    but should go in as..
    Please Login or Register  to view this content.
    I HAVE NOW FIXED THIS BIT BY CHANGING CODE TO READ...
    Please Login or Register  to view this content.
    To explain a little more background to what I am actually doing....(not sure if it helps at all but here goes)..

    My loop is checking a sheet for a heading (Blankcol) and if it finds it, it puts in a blank column. It should also colour it yellow as it then will become a total column of previous columns depending on the heading - for example, if the heading (variable BlankCol) matches and it is to add up the previous 4 columns (AddCol is value 4 at the time in the loop), it should change format to general and put in the formula to add up the previous 4 columns...

    **** I THINK I HAVE THE ORDER OF WHAT I WANT TO DO WRONG....**** PLEASE ignore this message until I come back as I think I need to mess with it more then will come back if it still does not work...

    dugong
    Last edited by dugong; 03-11-2008 at 08:19 AM.

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    dugong,

    It doesn't look like all the code is there. Also it's not related to your original question and should be in it's own thread e.g
    Please Login or Register  to view this content.
    VBA Noob

  8. #8
    Registered User
    Join Date
    10-23-2006
    Posts
    79

    New thread started

    Quote Originally Posted by VBA Noob
    dugong,
    Also it's not related to your original question and should be in it's own thread
    VBA Noob
    Hi VBA Noob - I have started a new thread and placed link to this post in it and also added the new post link here so others do not get confused...
    http://www.excelforum.com/showthread...97#post1893597

    I hope I have done the correct thing..?

    dugong

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1