Move range to another sheet

G

Gene Augustin

I have a range named JOBNAME on Worksheet2 named Worksheets("RawData")
I want to select that same range in Column C on empty worksheet 1 named
Worksheets("FormatData") and enter a formula removing the first three
characters based on the data in the range JOBNAME on worksheet 2

Worksheet(FormatData).Formula= Worksheet(RawData).Formula =
"=Mid(Range("Jobname"),4,20)
 
L

Laroche J

Gene Augustin wrote on 2009-03-15 09:00:
I have a range named JOBNAME on Worksheet2 named Worksheets("RawData")
I want to select that same range in Column C on empty worksheet 1 named
Worksheets("FormatData") and enter a formula removing the first three
characters based on the data in the range JOBNAME on worksheet 2

Worksheet(FormatData).Formula= Worksheet(RawData).Formula =
"=Mid(Range("Jobname"),4,20)


I'm not sure what you mean by "that same range in column C", but what the
program below does is create a formula in column C starting from the same
row than range jobname (if you want to start from row 1 remove both
references to jn_row)

Sub MoveData()

n = 1
jn_row = Range("jobname").Row - 1
For Each c In Worksheets("RawData").Range("jobname").Cells
Worksheets("FormatData").Columns(3).Cells(jn_row + n).FormulaR1C1 = _
"=Mid(index(Jobname," & Format(n) & "),4,20)"
n = n + 1
Next

End Sub


You seem to be quite a beginner with VBA. I suggest that when you don't know
how to write some code, let Excel do it for you, study the result and adapt
for your needs. In other words, record a new macro, do manually the actions
you want your finished macro to accomplish (or something similar), stop
recording then look at the code that was generated. There is usually too
much code (especially of the kind Select and Selection), but you'll get the
idea. But don't let that stop you from posting here.

JL
Mac OS X 10.4.11, Office v.X 10.1.9
 

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