need help in macro to select a column

joedhk

New Member
Joined
Jan 19, 2019
Messages
11
Hi.I am trying to insert excel data into PDF documents.in this is part of code I need help

Dim vClient As Variant

vClient = Range(Selection.Row & ":" & Selection.Row)

sFileFields = Replace(sFileFields, "---NAME1---", vClient(1, 2))
sFileFields = Replace(sFileFields, "---NAME2---", vClient(1, 3))
sFileFields = Replace(sFileFields, "---NAME3---", vClient(1, 4))

This code works for selection row but when i change it to
vClient = Range(Selection.column & ":" & Selection.column)

The code doesn't choose selected column. I want to select selection column just like row in upper code.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
if you recorded you action you would see that range isn't used but columns is

Columns("D:H").Select
 
Upvote 0
Cross posted https://www.excelforum.com/excel-pr...46-need-help-in-macro-to-select-a-column.html
and here http://www.vbaexpress.com/forum/showthread.php?64462-need-help-in-macro-to-select-a-column

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,114,002
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top