+ Reply to Thread
Results 1 to 19 of 19

Column/row and formatting referencing - every help appreciated!

  1. #1
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    41

    Column/row and formatting referencing - every help appreciated!

    Hi guys,

    Have been working on this workbook for 3 months and am nearly done. But something keeps bugging me and I’m completely stuck. Please help. I got such great advice last time that I thought that I would try again:

    I have 1 workbook with 2 sheets. The first sheet (call it sheet1) displays data. The second sheet (call it sheet2) displays only the print area. This print area directly refers to sheet1. In order to also make it track changes when a new column is added/deleted, I got amazing advice on this forum to use a nice variation of the index function: =INDEX(Data!$1:$1048576, ROW(), COLUMN())

    However, is there a way to also directly mirror the formatting and column/row size? If a row/column in Sheet1 for instance is 90, then it might still be a standard 15 in sheet2. The row sizes changes constantly in my sheet. Furthermoe, if some things are with bold or colored in sheet1, then this is not reflected in sheet2. Is there a way to solve this?

    Every advice would be extremely appreciated!! Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    I cannot think of a way that Excel could do what you want without VBA.

    Does all the data on sheet2 require formatting exactly like on sheet1?
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    Run the VBA in the attached workbook with {CTRL} t

    this assumes that last occupied cells in row1 and columnA of sheet2 define the size of the range

    Place in a general module:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 04-18-2017 at 09:00 AM.

  4. #4
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    41

    Re: Column/row and formatting referencing - every help appreciated!

    Thanks a lot for your response! really appreciated.

    However, I really like the inbuild function for two reasons:

    1. The size of the range is actually defined by a print area, which is only a 'snap-shot' of sheet1.
    2. Sheet1 is where the rough data is. Basically this means that rows will be hidden, and the filter will be used. With the inbuild function, it still displays rows that have been filtered away in the print area. The same goes for hidden rows.

    However, if the macro could somehow be adjusted to fit those criteria I would be very grateful! That is, if it is possible to build a macro that only copies from the print area, but also copies rows that may be hidden, filtered away etc. within the print area.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    I am a bit confused
    - perhaps you could attach your workbook so that I can see both sheets (click Reply, Go Advanced, scroll down to Manage Attachments etc) - cutdown to below 1mb
    - I assume this is financial info - convert any text into alphabet soup and the numbers will be meaningless

    I think it may be easiest to create a macro that toggles between 2 settings on sheet 1
    - normal view
    - print view (hidden columns, filtered rows)

    Then copy/paste print view to sheet 2

  6. #6
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    41

    Re: Column/row and formatting referencing - every help appreciated!

    As it is now, all I have to do is adjust the formatting and print area.

    However, if we are to use a macro, it would have to:
    -Set print area (which would need to be made dynamic)
    -Unhide rows
    -Unfilter
    -Print to sheet2
    -hid rows again
    -filter again

    So I think the solution that there is, where the formatting has to be adjusted (which is damn annoying), for now is the easiest solution. But honestly thank you!! Will give you some reputation now. Your time is much appreciated!

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    Without seeing what you are trying to achieve it's a bit tricky
    If you do not want to post your workbook, then can you explain the differences between the 2 sheets

    How are you filtering the data?
    - are you manually selecting?
    - are you using advanced filter?
    - VBA could apply the same filter to the 2nd sheet (if all the relevant fields are present)

    Are some columns visible on sheet 1 that are hidden on sheet 2
    - can you list the columns that should be hidden

  8. #8
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    41

    Re: Column/row and formatting referencing - every help appreciated!

    Completely understand that it is tricky when you can't see it - sorry, but it's just completely off-limits. Strict firm policy. My apologies. If possible, I would of course have send it.

    When filtering, I am manually selecting in sheet1. Some columns within the print area will then sometimes be hidden (this varies). Sheet1 also contains information outside of the print area.

    What I would seek to do in sheet2 would be to copy/paste all information that is in sheet1 - but only in sheet1 print area. Note that in sheet1 print area there might be several rows hidden. I want these rows to remain hidden in sheet1, but to be displayed in sheet2. Similarly, some things may be filtered away in sheet1 - these things should remain filtered, but should not be filtered in sheet2.

    Hope this makes sense

  9. #9
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    ok - I will see what I can do

  10. #10
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    41

    Re: Column/row and formatting referencing - every help appreciated!

    Thank you!! Just to clarify: in sheet1 I have a print area, where I manually adjust the range (but there is also data outside the print area). However, within that print area, I hide rows and filter them. I want to sheet2 to display only the print area from sheet1, but it needs to be unfiltered and without hidden rows.

    If you could come up with a fix it would be really awesome! Would mean that this 3 month assignment would finally be done. Crossing my fingers

  11. #11
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    I am not suggesting this as the solution necessarily but would this yield the correct values on sheet2?

    - Paste everything from sheet 1 to sheet 2 with nothing filtered or hidden
    - Hide every row outside the print area
    - Hide every column outside the print area
    - Do we need to hide anything inside the print area?
    - Does the "print area" include all the headings of your columns that you need pasting to other sheet?
    (are you using page setup "rows repeated at top" for your printing)

    please amend as necessary - I am trying to get the correct picture in my head

    thanks
    Kev

  12. #12
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    Give this a try - it seems too simple but it may do what you need
    It basically hides (in Sheet2) any columns to the right and left of the print range and shows all columns inside the print range

    Replace names for sheets1 & 2

    Assumption1
    I have assumed that sheet2 contains ALL the values in sheet1 (all columns , all rows) using formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    (ie everything that appears on sheet1 automatically appears on sheet2 in the exact same cell)
    If that assumption is not correct - please create sheet with that assumption satisfied and see if it gives you what you want.

    Assumption2
    The print range is one contiguous block.
    If that is not correct please explain what you do

    Please Login or Register  to view this content.
    Last edited by kev_; 04-21-2017 at 06:11 AM.

  13. #13
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    If the above gives you the range correctly, I will add in row height and column width matching

    Getting at the height of rows is the tricky bit.
    Unfortunately, when hidden via filtering, it appears that the only attribute that VBA can get its hands on returns a height of zero (due to the filtering), which is rather annoying - I have a workaround (hence the question below) but I would prefer a simpler solution

    How complex is your filtering and is it regularly varied?
    What I am thinking is that VBA [or you manually] could remove the filter to allow all the data to be copied to the other sheet - allowing the row to be set at the correct height
    - provided data is not sorted AFTER the filter is removed, row number in sheet2 matches sheet 1 irrespective of filtering
    Last edited by kev_; 04-22-2017 at 08:45 AM.

  14. #14
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    Incidentally, what you are trying to do is quite the opposite of what Excel has available in its standard toolkit
    Using Advanced Filter - you can automatically paste filtered values to another sheet leaving the original sheet unfiltered
    - unfortunately whilst cell formatting does transfer with the data, column widths and row heights do not

  15. #15
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    I had become blinkered (and obsessed!) with finding the height of the row whilst the data was filtered - when it was not necessary
    Blinkers off:

    Amend sheet names for ws1 and ws2
    Please Login or Register  to view this content.
    Last edited by kev_; 04-24-2017 at 02:40 AM.

  16. #16
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    41

    Re: Column/row and formatting referencing - every help appreciated!

    Thanks so much! Will try next week and get back to you. A lot of new deals in the market so cant work on it this week. Will get back to you. Thanks so much! Honestly really appreciated

  17. #17
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    No problem -busy myself for next two weeks - so that suits me too!

  18. #18
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    41

    Re: Column/row and formatting referencing - every help appreciated!

    This worked excellent. Thank you Kev!! However, might after several requests change the lay-out a abit. But top notch what you did! Really appreciated. May you have an excellent day!!

  19. #19
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Column/row and formatting referencing - every help appreciated!

    Good - very glad it's working the way you want.
    Kev

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 03-09-2014, 05:22 PM
  2. Referencing conditional formatting in VBA
    By strud in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2013, 10:45 AM
  3. [SOLVED] List Unique Data referencing column C for Team and column B for Name
    By arekkusu03 in forum Excel General
    Replies: 7
    Last Post: 09-04-2012, 09:40 AM
  4. Conditional formatting referencing 2 sheets
    By Phosu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2011, 12:34 AM
  5. Conditional formatting referencing another sheet and returning multiple column items
    By Bundleodaisies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-29-2010, 04:12 PM
  6. Conditional formatting referencing another sheet and returning multiple column items
    By Bundleodaisies in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-28-2010, 10:04 PM
  7. keep formatting when referencing cells
    By Beard in forum Excel General
    Replies: 1
    Last Post: 02-20-2006, 11:30 AM
  8. [SOLVED] Formatting when referencing?
    By Beard in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-18-2006, 04:45 PM

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