Dynamic macro's

E

Ekser

Hi,

Thanks for your reply.
Well, the user will select a complete row (1 or 2 or 3 or ....) an
based upon that, the program should do the code as described for 3, bu
for that particular row.

For instance, if he selects the row 8, the code should be:

Dim appWD As Word.Application
' Create a new instance of Word & make it visible
Set appWD = CreateObject("Word.Application.8")
appWD.Visible = True
Sheets("Template").Select
Range("A8").Copy
Sheets("Data").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:
_
False, Transpose:=False
Sheets("Template").Select
Range("C8").Copy
Sheets("Data").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:
_
False, Transpose:=False


So, is there some wildcard to use, something like Range("A*$*").Copy
 
G

Guest

hi again,
your code reads
-----Original Message-----

Hi,
your code reads(line 6)"range("A8").copy.
this is a single cell. not a row. and wheather you user
has the row selected means nothing to the code. the code
does what it is instructed to do.
to select the entire row
Range("A8",Range("A8").end(xltoright)).select
this will select all the data in the row, provide there
are no empty cells in row 8
Range("A8").offset(0,10).select
This will select 10 columns to the right including empty
cells.
The Code will not select a highlighted area. period.
You will have to develope criteria(like above) to instruct
the code on what to select.
There is no wild card select characters.
Regards
Thanks for your reply.
Well, the user will select a complete row (1 or 2 or 3 or ....) and
based upon that, the program should do the code as described for 3, but
for that particular row.

For instance, if he selects the row 8, the code should be:

Dim appWD As Word.Application
' Create a new instance of Word & make it visible
Set appWD = CreateObject("Word.Application.8")
appWD.Visible = True
Sheets("Template").Select
Range("A8").Copy
Sheets("Data").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Sheets("Template").Select
Range("C8").Copy
Sheets("Data").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:=
 

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

Similar Threads


Top