Wrox Programmer Forums code for formulas
 |
 Excel VBA Discuss using VBA for Excel programming.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com

October 27th, 2010, 11:23 AM
 mtranchi Friend of Wrox Join Date: Sep 2010 Posts: 171 Thanks: 0 Thanked 14 Times in 14 Posts

you may have to play around with the offsets to get them right.
Code:
`.offset(0,1)`
the first number (0) represents the row number and you'll want to leave that at zero becuase you want to effect the row you're in. The second number (1) represents the column and that's the one you may need to tinker with. The key thing to remember is that Offset is zero based, so for example if you're in cell "A1":
Code:
```.offset(0,0) 'refers to cell A1
.offset(1,0) 'refers to cell A2
.offset(0,1) 'refers to cell B1```
also, if for whatever reason you change that code around so it's not using the With Target line, Offset is a member of the Range object, so a fully qualified line would look like
Code:
`Range("A1").Offset(0,1) = 5 'puts 5 into cell B1`

October 27th, 2010, 11:38 AM
 mtranchi Friend of Wrox Join Date: Sep 2010 Posts: 171 Thanks: 0 Thanked 14 Times in 14 Posts

sorry, i know how to program in VBA pretty well, but explaining is something I don't have much practice at.
A FULLY qualified reference would look like
Code:
`Workbooks("Book1.xlsm").Sheets("Sheet1").Range("A1").Offset(0, 1) = 5`

October 28th, 2010, 04:04 AM
 tofimoon4 Registered User Join Date: Oct 2010 Posts: 6 Thanks: 0 Thanked 0 Times in 0 Posts

Dear sir,with my thanks and apology,can i send an email with my request to your email because i have headache from this problem.
My appreciation.

October 28th, 2010, 04:07 AM
 mtranchi Friend of Wrox Join Date: Sep 2010 Posts: 171 Thanks: 0 Thanked 14 Times in 14 Posts

sure, mtranchi@hotmail.com

October 28th, 2010, 04:17 AM
 mtranchi Friend of Wrox Join Date: Sep 2010 Posts: 171 Thanks: 0 Thanked 14 Times in 14 Posts

only if it includes **************** pics of code, lol

October 28th, 2010, 04:27 AM
 mtranchi Friend of Wrox Join Date: Sep 2010 Posts: 171 Thanks: 0 Thanked 14 Times in 14 Posts

the code should work.
i'm about to go to sleep, but if you paste that code into the module behind the spreadsheet you should be alright

October 28th, 2010, 04:33 AM
 mtranchi Friend of Wrox Join Date: Sep 2010 Posts: 171 Thanks: 0 Thanked 14 Times in 14 Posts

i'm still up, we need to get on the same page. i tested the code i last sent you so i know it works. it's probably a matter of if you have it pasted in the right module
Hurry up and answer or i'm going to sleep and i've got a bunch of other stuff to do tomorrow. if i don't hear from you soon, i'll try to get back to you asap. i know how frustrating it is to know what you want to do, but not how to do it

 Similar Threads Thread Thread Starter Forum Replies Last Post Formulas Juan0214 Access 4 July 2nd, 2008 02:04 PM Formulas work in preview not online andiadmin Infopath 0 April 16th, 2007 12:01 PM Need help with time formulas pfreire727 Excel VBA 1 February 12th, 2006 07:41 PM Inputbox and Formulas bahachin Excel VBA 3 February 17th, 2005 01:39 AM