Using VB to code a Macro within Excel 2000

  • Thread starter Thread starter Danny Mayhew
  • Start date Start date
D

Danny Mayhew

I am new to VB coding. If I have an Excel sheet with
columns A - E, etc and I want to locate or go to the
first position (or any position) of the info data that is
contained within a certain column or row and want to
compare the data that is in that position to e.g. "G" and
if it is "G" I would like to "cut" and "Paste" the result
to another column or row, How would I code it?

Thanks. I would appreciate any assistance.
 
Here is one guess base on your vague description. This works row wise.

Assuming your rows contain hard coded data (not formulas)

Dim rng as Range
On error Resume Next
set rng = Cells(ActiveCell.Row,"A").Resize(1,5).SpecialCells(xlConstants)
On Error goto 0
if not rng is nothing then
Cells(Activerow,"G").Value = rng(1).Value
rng(1).ClearContents
End if
 
Back
Top