Home > Software engineering >  O greatly help to solve the problem of a small column for top!
O greatly help to solve the problem of a small column for top!

Time:10-23


'cell phone number
Range (" i2: I10000 "). Copy
Worksheets (1). The Range (" i2: I10000 "). SpecialCells (xlCellTypeVisible). Copy Worksheets. (2) the Range (" i2)

'phone number
Range (" i2: I10000 "). Copy
Worksheets (1). The Range (" i2: I10000 "). SpecialCells (xlCellTypeVisible). Copy Worksheets. (2) the Range (" H4 ")

Background: software export excel table, now I listed in table 1 with fixed phone number and the number, click on the converted automatically copy this column to the table 2, but because it is copy all visible, now I just want to contact phone number 11 before I listed in table 1, mobile phone number from table 2 for 12, how to write? Don't try too much way success

CodePudding user response:

Don't understand ah, would answer for you, but completely look not to come out to copy the data format of the column, can make the format of the data column for example?

CodePudding user response:

Don't understand the data formats, but can build a macro, according to this method, the previous 11 below code
For I=4 to 10000
Take before 11
'Worksheets. (2) the Range (" I "& amp; I). value=https://bbs.csdn.net/topics/left (Worksheets (1). The Range (" I "& amp; I). The value, 11)
Next

Here is to take after 12 code, replace to the location of the above is ok
'after taking 12
Worksheets. (2) the Range (" I "& amp; I). value=https://bbs.csdn.net/topics/right (Worksheets (1). The Range (" I "& amp; I). The value, 12)

CodePudding user response:

The building Lord give not data format, is his code,

CodePudding user response:

Method 1: use for... Next structure completed

Method 2: use "were" method can be completed
 
Sub Test ()
'the first step: extract before 11 characters
Sheet1. Range (" i2: i10000 "). The TextToColumns Destination:=Sheet1. Range (" k4), DataType:=xlFixedWidth, _
FieldInfo:=Array (Array (0, 2), Array (8, 2)), TrailingMinusNumbers:=True
'the second step: copies respectively after the character to sheet2 (as if step do not directly)
Sheet1. Range (" k4: k10000 "). Copy Sheet2. Range (" i2) 'Copy the previous 11
Sheet1. Range (" l4: k10000 "). Copy Sheet2. Range (" j4 ") 'Copy rest
End Sub

CodePudding user response:

The original poster is which country?
Mobile phone number "12", don't phone number has been more than 12 total length?

The phone number of our country to 11...
  •  Tags:  
  • VBA
  • Related