Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Find row and insert formula, skipping columns

Hello ... I need some help building code to find a specified row and
insert a formula in every other column. The sheet is set up like
this:

Column C holds the value to be matched against
Column E is the first column to add the first formula, and then in
every other column out to Col BY (so E/G/I/etc).

The value to match will be hard-coded into the code itself ...

Any/all help is greatly appreciated...

Regards,
ray

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Find row and insert formula, skipping columns

Try something like this:

Private Sub TestMatching()
Dim sValue As String, dX As Double, dY As Double

sValue = "Text to find a match for" 'hardcoded thing you're
wanting to match. I'm assuming it's a string, but you can change it
to a number type if you want.

'loop through all populated rows in column C
For dX = 1 To ActiveSheet.UsedRange.Rows.Count
If Cells(dX, 3).Value = sValue Then
'if a match is found, loop through every other adjacent
column and then add the formula
For dY = 5 To 78 Step 2
Cells(dX, dY).Formula = "=C" & dX 'this formula
equals the value in column C. Change the formula to whatever you
need.
Next
End If
Next

MsgBox "All done"
End Sub


On Oct 30, 8:22 am, Ray wrote:
Hello ... I need some help building code to find a specified row and
insert a formula in every other column. The sheet is set up like
this:

Column C holds the value to be matched against
Column E is the first column to add the first formula, and then in
every other column out to Col BY (so E/G/I/etc).

The value to match will be hard-coded into the code itself ...

Any/all help is greatly appreciated...

Regards,
ray



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum skipping columns Steve Excel Discussion (Misc queries) 6 March 27th 12 03:15 PM
Summing across columns while skipping some columns JAG Excel Worksheet Functions 2 February 28th 10 02:58 PM
Skipping Columns [email protected] Excel Programming 2 July 31st 06 11:06 PM
skipping columns part 2 Wazooli Excel Worksheet Functions 0 January 19th 05 07:41 PM
skipping columns Wazooli Excel Worksheet Functions 2 January 19th 05 05:11 PM


All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"