ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy column data (https://www.excelbanter.com/excel-programming/351900-copy-column-data.html)

Sylvia[_19_]

Copy column data
 

Hi,

I want to write a macro by whic I will mention the number of character
in one column then it should select only those number of characters fo
the entire row.

eg. if I mention number of characters as 6 for 'column a', (I wil
mention this in a seperate column. Macro should read this value fro
that column) then it should copy only 6 characters of EACH cell i
'column a'

Do we anything kind of format etc for this thing?

Thanks,
Sylvi

--
Sylvi
-----------------------------------------------------------------------
Sylvia's Profile: http://www.excelforum.com/member.php...fo&userid=3030
View this thread: http://www.excelforum.com/showthread.php?threadid=50666


Tim Williams

Copy column data
 
Where should the values be copied to?

Tim


"Sylvia" wrote in
message ...

Hi,

I want to write a macro by whic I will mention the number of characters
in one column then it should select only those number of characters for
the entire row.

eg. if I mention number of characters as 6 for 'column a', (I will
mention this in a seperate column. Macro should read this value from
that column) then it should copy only 6 characters of EACH cell in
'column a'

Do we anything kind of format etc for this thing?

Thanks,
Sylvia


--
Sylvia
------------------------------------------------------------------------
Sylvia's Profile:
http://www.excelforum.com/member.php...o&userid=30300
View this thread: http://www.excelforum.com/showthread...hreadid=506668




Sylvia[_20_]

Copy column data
 

In the new worksheet

--
Sylvi
-----------------------------------------------------------------------
Sylvia's Profile: http://www.excelforum.com/member.php...fo&userid=3030
View this thread: http://www.excelforum.com/showthread.php?threadid=50666


Tim Williams

Copy column data
 
Sub Tester()
Dim s As Worksheet
Dim s2 As Worksheet
Dim r As Long, x

Set s = ActiveSheet
Set s2 = ThisWorkbook.Sheets("Sheet2")

r = 1
x = Application.InputBox("Enter number of characters", _
, , , , , , 1)

Do While s.Cells(r, 1).Value < ""
s2.Cells(r, 1).Value = Left(s.Cells(r, 1).Value, x)
r = r + 1
Loop
End Sub

Tim



"Sylvia" wrote in
message ...

In the new worksheet.


--
Sylvia
------------------------------------------------------------------------
Sylvia's Profile:
http://www.excelforum.com/member.php...o&userid=30300
View this thread: http://www.excelforum.com/showthread...hreadid=506668





All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com