You are here:

Excel/lame, simple syntax question



Some years back, you helped me immensely with VBA code to automate the daily transfer of some reporting information from various columns in a master "timeline" tab, to two adjacent "form" master templates that I could print & file daily.  I've not used that macro for a long time, but now will use it regularly.  To adapt, I needed to tweak things a little to add detail to and make some other improvements in reporting methods.

Getting to the nub of this, your typical data-transfer code is represented by this line:
sh.Range("C43") = shMaster.Cells(r.Row, "H") 'fill C43 in template with text from Col H from that day's entry

That still works fine for most data.

But now, instead of transferring the data from daily-changing column H for a given date to C43 in sh.Range, there are some cases where I want to transfer from, say, cell C2 (and never increment).  What's that syntax?

I apologize for even having to ask, but I simply couldn't seem to Google my way into a solution for this.




sh.Range("C43") = shMaster.Cells(r.Row, "H")

to always grab from C2 would be

sh.Range("C43").Value = shMaster.Range("C2").Value
This should be outside of any loops since it only needs to be done once.

If that isn't what you are asking, perhaps you could provide a bit more detail.

Tom Ogilvy  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2017 All rights reserved.