Hi there,
I am new to macros, so please bear with me. I am not used to editing the codes, and I am unfamiliar with the slang. So far, I am doing my best... here goes my question.
I wanted to print specific information into an invoice. I found a code to use... I copied this code from this site:
http://www.contextures.com/xlForm03.html
It works fine, but I would like to tailor it a bit. Can someone suggest a way for me to a)use "p" instead of "x" as the data indicator; b)change the range so that I can use specific cells in a row, instead of ALL cells in a row.
Thank you. I hope that I made enough sense for you =)
Best
As written, anything can be used to "mark a row".
This line details where data is put into the form/worksheet to be printed.
As written, the code puts the first 7 values on a marked row into that output sheet. If you want to control which columns on a marked row go to the output sheet.myAddresses = Array("E5", "E6", "B10", "E25", "B16", "C16", "D16")
Add
immediatly after the myAddresses line.Dim myInputColumns as Variant:Rem this line can go at the start of the routine. myInputColumns = Array(1,2,3,4,5,6,7)
And change the line to this:
By changing the 1,2,3,..,7 to the columns you want, you will get the control you want. Make sure that the myInputColumns is as large (or larger than) the myAddress array.For iCtr = LBound(myAddresses) To UBound(myAddresses) FormWks.Range(myAddresses(iCtr)).Value _ = myCell.Cells(1,myInputColumns(iCtr)).Value
Amazing! Thank you
Hi mikerickson,
I am new to macro coding but I seek your help in explaining the following:-
'cells to copy from Input sheet - some contain formulas
myCopy = "D5,D7,D9,D11,D13"
what is D5,D7,D9.......? what does it represent? If I want to copy more columns,how do I do it,Thanks a million
I can't find that quote in any of the references in this thread. (Unless it is from the contexures link in the OP, other users of this forum would benifit more if this discussion were its own thread.
If it is code, then
The apostrophy at the start of the first line indicates that that line is a comment.'cells to copy from Input sheet - some contain formulas myCopy = "D5,D7,D9,D11,D13"
The next line sets the variable myCopy to the string "D5,D7,D9,D11,D13"
I would need to see the rest of the code to tell you how it fits together.
Since those cell addresses are all in the same column, we definatly would need to see the code to make it work on more than column D.
Please start a new thread. If you post the code in that thread, please wrap it.
seanyeap
Please read forum rules & wrap your VBA code
A thread with the rules is available at the top of each forum or see links below
If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
http://www.excelforum.com/excel-general/583950-excel-macro-acting-differently-on-two-machines.html
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 assistedor failed to assist you
I welcome your Feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks