<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Problem with this code</title><link>https://www.infopathdev.com:443/forums/thread/14671.aspx</link><pubDate>Wed, 21 Jun 2006 15:43:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14671</guid><dc:creator>Carolyn</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14671.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14671</wfw:commentRss><description>&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;&lt;i&gt;Originally posted by G105ALY&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Is it possible to use this with a do loop for a range of cells i.e. b14:014?&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;Sure. &lt;br /&gt;&lt;br /&gt;I'll tell you how I usually handle these kinds of things in Excel VBA. Your data is arranged such that you need it to march across a row to various columns.&lt;br /&gt;&lt;br /&gt;Sub temp()&lt;br /&gt;'start at the beginning&lt;br /&gt;Range("B14").Activate&lt;br /&gt;'start the loop&lt;br /&gt;Do While ActiveCell.Value &amp;lt;&amp;gt; ""&lt;br /&gt;'''insert here the relevant code that you want&lt;br /&gt;'''done on each cell&lt;br /&gt;'move to the next cell (horizontally)&lt;br /&gt;ActiveCell.Offset(0, 1).Activate&lt;br /&gt;'end the loop&lt;br /&gt;Loop&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Note several things. I usually have a block of data and never know how many columns or rows there are. Therefore I make the loop go until it hits a blank. (Value &amp;lt;&amp;gt;"")&lt;br /&gt;&lt;br /&gt;Second, the Offset function has two arguments. Offset(row#, column#). In this case we want to stick to the same row and move across horizontally, thus, the row offset is zero and the column offset is 1. &lt;br /&gt;&lt;br /&gt;If, instead, you were moving down a single column row by row, the code would say:&lt;br /&gt;&lt;br /&gt;ActiveCell.Offset(1, 0).Activate&lt;br /&gt;&lt;br /&gt;This scenario is far more common in my work, as I usually need to "process" a table of data and do the same thing to each entry in a given column.&lt;br /&gt;&lt;br /&gt;Finally, have you considered using range names instead of addresses? Give B14 a name, and use that name in the Range("B14") statement. That way, should you insert columns or rows in the future the name will move with the insert. Otherwise, you'll have to edit your code to whatever the new range address is. That can be a real drag.</description></item><item><title>Re: Problem with this code</title><link>https://www.infopathdev.com:443/forums/thread/14670.aspx</link><pubDate>Wed, 21 Jun 2006 12:45:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14670</guid><dc:creator>G105ALY</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14670.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14670</wfw:commentRss><description>Many thanks, this now works.&lt;br /&gt;&lt;br /&gt;Is it possible to use this with a do loop for a range of cells i.e. b14:014?&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: Problem with this code</title><link>https://www.infopathdev.com:443/forums/thread/14669.aspx</link><pubDate>Tue, 20 Jun 2006 15:18:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14669</guid><dc:creator>Carolyn</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14669.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14669</wfw:commentRss><description>Try this:&lt;br /&gt;&lt;br /&gt;Dim myComment As String&lt;br /&gt;myComment = Range("A1").Text&lt;br /&gt;Range("A1").AddComment&lt;br /&gt;Range("A1").Comment.Text Text:=myComment&lt;br /&gt;End Sub</description></item><item><title>Problem with this code</title><link>https://www.infopathdev.com:443/forums/thread/12903.aspx</link><pubDate>Mon, 19 Jun 2006 10:17:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12903</guid><dc:creator>G105ALY</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12903.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12903</wfw:commentRss><description>Hi guys,&lt;br /&gt;&lt;br /&gt;I am using VBA in Excel with imported data, can anyone tell me why this code won't work:&lt;br /&gt;&lt;br /&gt;Sub Test()&lt;br /&gt;Dim mycomment As String&lt;br /&gt;mycomment = Range("a1")&lt;br /&gt;Range("a1").Comment.Text.mycomment&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;I want it to show the contents of a cell in a comments box.  Any help would be most appreciated?</description></item></channel></rss>