Using VB to code a Macro within Excel 2000

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.
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top