PC Review


Reply
Thread Tools Rate Thread

coding for variable rows

 
 
Brad K.
Guest
Posts: n/a
 
      12th Feb 2008
I am trying work on sheet that has data pasted to it that always has the same
columns but rows vary each time. I need to enter a value into "B" column and
a formula into "H" & "I" for each row that has data. I have a couple of
macros that do most this, but can't consistently make it work. Any
suggestions?
Thanks,
Brad K.
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      12th Feb 2008
Depends somewhat on what you are doing, eg FormulaR1C1 might work better.
following just for ideas -

Sub test()
Dim nLastRow As Long

' sample data in col-A
For i = 2 To 11
n = n + 10
Cells(i, 1).Value = n
Next

nLastRow = Range("A65536").End(xlUp).Row

Range("B2:B" & nLastRow).Value = 5

Range("H2:H" & nLastRow).Formula = "=A2+B2"
Range("I2:I" & nLastRow).Formula = "=H2 * 10"

End Sub

Regards,
Peter T

"Brad K." <(E-Mail Removed)> wrote in message
news:6FC3416D-0C5F-4D46-96E0-(E-Mail Removed)...
> I am trying work on sheet that has data pasted to it that always has the

same
> columns but rows vary each time. I need to enter a value into "B" column

and
> a formula into "H" & "I" for each row that has data. I have a couple of
> macros that do most this, but can't consistently make it work. Any
> suggestions?
> Thanks,
> Brad K.



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
variable coding help m stroup Microsoft Access VBA Modules 1 16th Mar 2010 01:03 PM
Autofil on variable rows, delete extract and show remaining rows 1plane Microsoft Excel Programming 3 17th Nov 2009 10:49 AM
for next coding wants me to define variable... gab1972 Microsoft Excel Programming 4 20th Jul 2009 05:29 PM
Use variable in macro coding bmurlidhar Microsoft Excel Misc 3 17th Jul 2009 10:37 AM
Variable coding Dave Microsoft Excel Programming 1 26th Sep 2007 06:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:37 AM.