+ Reply to Thread
Results 1 to 23 of 23

Texts and values from one sheet to another sheet with specific criteria and format.

  1. #1
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Texts and values from one sheet to another sheet with specific criteria and format.

    In attached sample file, there are two sheets, one is basic data and another is expected result. Expected result is expected from the table given in Basic Data Sheet.

    Whenever there is change in the data in the table in Basic Data Sheet there should be automatic change in the table of Expected Result Sheet. It means it should be automatically or manually (by macro to buttons) get updated.

    In the table of Basic Data Sheet column of Batch No. two batches are separated by dot instead of comma and in the column of Total Number of Batches, number of batches in which employee has worked is shown. Table start range is A4 and if require it may vary in future. But if position of the table changes in future then it may be located A4 or below that row. If possible, in case if I change table position in basic data sheet, there should not be any problem in code execution. Also, in case of table in Basic Data Sheet, data entry may extend and reach up to 1000 and plus rows.

    In the table given in Expected result sheet, all the text and values in all columns should be automatically or manually get updated when texts or values get change in the Basic Data sheet. Column of Batch No is expected to get arranged from small number to large number in all cells. Batches in numbers will be reflected in In Number column.

    Your help is appreciable as I am basic user and expecting (if possible) explanation of the code so that i can also work on it if require.
    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Give this code a try. I still need to sort the consolidated batch number field.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Hello, code extracts data in proper manner. Just following issues found.
    1. In the column 'Batch No.', when numbers are in large quantity (as shown in image), width of the column become wider. It will be fine if numbers will be autofit in the same cell by text wrap function. (By removing last line "rs.Range("E7:I" & c).Columns.AutoFit", this problem no 1 is solved).
    2. In the column 'In Numbers', batch number of the employee is not reflected. (possibly you are working on it and will get reflected soon.))
    3. And I know as you are working on sort function, sorting will be available for department and employee Batch No.

    Thanks for your help.
    Attached Images Attached Images
    Last edited by chintamani.avinash; 02-18-2022 at 06:40 PM.

  4. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Here is the updated code. Let us know how it goes.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Great...
    Its working. Brilliant. You smoothen my job. Adding reputation friend.


    Just one Issue: When columns like 'Name of the employee', 'Batch No.' and 'Total Number of Batches' remains blanks, code produce error. Instead of error is it possible to show message that 'Fields are Blanks' or something like that.

    Thanks for your help.
    Last edited by chintamani.avinash; 02-19-2022 at 01:41 PM.

  6. #6
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    I've updated the code to include "Blank Field" whenever a Name is blank, and update the batch number to "0" when that field is blank. You'll see the "0" in the batch number field and it is still counted as an item. The Titles are also bolded.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Hello,
    Following error is occurred. Screenshot is attached.
    Attached Images Attached Images

  8. #8
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    ensure the following code is under the updated code:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Thanks...It is Working greatly.
    Just one issue is that, in Basic Data Sheet numbers are stored in Text format but when code executes it converts into General format. This converts 10.20 into 10.2 as shown in image. File is also attached.
    Attached Images Attached Images
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    I added one line of code to format that cell as text.

    Please Login or Register  to view this content.
    I also added a line to autofit the rows.

    Please Login or Register  to view this content.
    Here is all the code with updates.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    excellent, Code works smooth and giving perfect result. Thanks a lot.

    Only one concern from my side, when I tried to collaborate this code into my main file for some extra output. I tried to add extra two columns in "J" and "K" columns in which I will put some figures and formula manually. Also I tried to give heading to the table in the range of A1:I5. But when I tried to update table values from the code, all other heading text and two newly created columns also vanished. Is possible that code will refresh text and values in the table region only i.e. Column E to I and other cells will not be refresh so that new Columns, texts will remain intact and will not be changed.

    Sorry to bother you but I did not realized that except table other cells are also refreshing.
    Your help is appreciable.

  12. #12
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Replace

    Please Login or Register  to view this content.
    With

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Hello,
    When I replaced the code following error occurred. But when i remove
    Please Login or Register  to view this content.
    then there is no error also do not delete any value or words but no idea if there is any other issue.
    Attached Images Attached Images
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Error was because the following had italic quotation marks but now corrected:

    wstest.Range("E7:I" & wstest.Cells(Rows.Count, 5).End(xlUp).Row).Clear
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  15. #15
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Excellent friend,
    All issue is solved.
    You are brilliant, humble and having great patience. Thanks a lot...

  16. #16
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Thanks John for the assist. I wrote post #12 with my phone's keyboard. That keyboard uses the italic quotes. Good to know going forward.

  17. #17
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Quote Originally Posted by JohnTopley View Post
    Error was because the following had italic quotation marks but now corrected:

    wstest.Range("E7:I" & wstest.Cells(Rows.Count, 5).End(xlUp).Row).Clear
    Thanks John, Excellent work by you made my job truly very smooth. Thanks friend. Adding reputation.

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    All the real work was done by maniacb so that's where the honours should go.

  19. #19
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Actually I am thankful to both of you maniacb and John. I got expertise from two experts. Thanks to both of you.

  20. #20
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    You’re welcome. I am glad I could help.

  21. #21
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Hello, Thanks for previous help. It helped me a lot in the work.
    Now including below mention code in my another work but finding problem some problems with the following new changes:

    1. In Basic Data sheet, now i have made sheet protected in which only Column D to H and J and K are unlocked, whereas others are locked.
    2. I have inserted formula in all cell to calculate number of Batch automatically. It is inserted from I8 to I1500.
    3. Now i want to work attached code smoothly with the above two conditions in only for the Range(F8:H1500) I.E. for column F,G, & H and row 8 to row 1500 only. So that in other areas i can write anything or add columns.

    I am thankful for previous help.
    Expecting help for above conditions so that i can use it in new work.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by chintamani.avinash; 06-25-2022 at 03:34 AM. Reason: sample upload

  22. #22
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Try this code. I just added code to unprotect the sheet upfront and then re-protect the sheet before closing the code. Let us know how this works out.

    Please Login or Register  to view this content.

  23. #23
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Texts and values from one sheet to another sheet with specific criteria and format.

    Hello Thanks for reply,

    blank rows where i have kept formula, because of this result sheet showing 0.0.0.0.0 like error in result sheet, sr. no. 13.
    Attached Files Attached Files

+ 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. Extract Texts and values from the table from other sheet
    By chintamani.avinash in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 02-12-2022, 01:46 PM
  2. [SOLVED] Copy specific column data from one sheet to another sheet using Certain filter Criteria
    By xlhelp7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-02-2017, 12:09 AM
  3. Replies: 8
    Last Post: 05-08-2016, 12:48 AM
  4. [SOLVED] Searching Values that Follow a Specific Format and Copy Rows to a New Sheet
    By aviatecar in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-18-2014, 07:11 AM
  5. how to automatic merge data from specific sheet to another sheet with same format?
    By pedyjay in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2014, 07:38 PM
  6. [SOLVED] Copy and paste data from sheet 2 to sheet 1 based on specific criteria on sheet 1
    By VBADUD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 04:18 AM
  7. Replies: 4
    Last Post: 08-29-2012, 10:32 AM

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