• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

VBA to Copy Text from Rows, Based on Cell Value Being X|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / VBA to Copy Text from Rows, Based on Cell Value Being X|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosVBA to Copy Text from Rows, Based o…
sp_PrintTopic sp_TopicIcon
VBA to Copy Text from Rows, Based on Cell Value Being X
Avatar
Tori Grant

New Member
Members
Level 0
Forum Posts: 1
Member Since:
June 26, 2020
sp_UserOfflineSmall Offline
1
July 2, 2020 - 4:19 am
sp_Permalink sp_Print

Hi. 

I have good basic Excel skills, and no experience  with VBA. 

My company uses Excel to calculate estimated costs for our remodeling projects. The Scope of Work is entered as text in the column and rows next to the Item being estimated. I  want to copy the Scope of Work text into an adjacent worksheet or separate workbook, so that the Designer can finish writing the scope of work, adding details, measurements ,etc., without having to use Copy/Paste between sheets/workbooks.

I found the IFSUMIF formula to determine if the Scope of Work needs to be copied from the Estimating Sheet to Scope of Work Sheet. See the screen shot. Logic: If QTY is more than Zero, enter X into a cell. If X, then copy the text from cells or range into another worksheet.

The master Estimating workbook has 30 +/- worksheets, not including the Scope of Work sheets for each Item.  I can add the Scope of Work worksheets to the Estimating Workbook, but that will make a huge file of 65 +/- tabs. 

Questions: 

1)Can this be done with formulas or should I use VBA?

2)Would the VBA code be different for each worksheet? 

3)Would it be better to have the Scope of Work be a separate workbook, and use VBA to reference the Estimating Workbook? I don't know at what point the Excel program slows down in relationship to file size.

Thanks in advance for help, advice, suggestions. 

ToriEstimate-Scope.PNGImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage Estimate-Scope.PNG (211 KB)
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1514
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
July 2, 2020 - 11:37 pm
sp_Permalink sp_Print

Hi Tori,

If you can use a formula you should use it.  I'd only use VBA when a formula can't do what I need.

In this case you can get the data from the 'Site Prep Estimate' sheet directly into the 'STPREP SoW Example Finished' sheet, no need for an intermediate cell to store an X and then read that cell's value.

In B4 on 'Site Prep Estimate' I've entered 

=IF(SUMIF('Site Prep Estimate'!E5:E7,">0"), 'Site Prep Estimate'!B5:B7, "")

This will only work if you have dynamic arrays.

If you don't you can use the rather unwieldy formula in B15 instead

=IF(SUMIF('Site Prep Estimate'!E27:E34,">0"), 'Site Prep Estimate'!B26 & 'Site Prep Estimate'!B27 & 'Site Prep Estimate'!B28 & 'Site Prep Estimate'!B29 & 'Site Prep Estimate'!B30 & 'Site Prep Estimate'!B31 & 'Site Prep Estimate'!B32 & 'Site Prep Estimate'!B33 & 'Site Prep Estimate'!B34, "")

I'd keep all the data together for ease of use.

Also, merging cells is not a good idea.  It causes all sorts of issues.

Regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
John Chisholm
vexokeb sdfg
John Jack
Malcolm Toy
Ray-Yu Yang
George Shihadeh
Naomi Rumble
Uwe von Gostomski
Jonathan Jones
drsven
Forum Stats:
Groups: 3
Forums: 24
Topics: 6212
Posts: 27236

 

Member Stats:
Guest Posters: 49
Members: 31888
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.