fotodj
09-01-2014, 07:48 PM
Can you help me with a code? How can I use ENTER key instead of clicking Button10?
Here is the code for button:
Sub Button10_Click()
'
Range("B1") = Null
With ActiveSheet.QueryTables.Add(Connection:= _
.Name = "D1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "1"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Range("D1") = Right(Range("D1"), Len(Range("D1")) - 5)
Dim i As String
Dim k As String
i = " C/N"
k = " C/N"
Columns("D").Replace what:=i, replacement:=k, lookat:=xlPart, MatchCase:=False
Range("D1") = Range("D1") & ", " & Range("C1")
Range(Cells(2, 3), Cells(2, 4)).Value = Null
Range("B1:C1") = Null
Columns("D").ColumnWidth = 68
Sheet1.Range("D1").Copy
Range("A1").Select
End Sub
Here is the code for button:
Sub Button10_Click()
'
Range("B1") = Null
With ActiveSheet.QueryTables.Add(Connection:= _
.Name = "D1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "1"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Range("D1") = Right(Range("D1"), Len(Range("D1")) - 5)
Dim i As String
Dim k As String
i = " C/N"
k = " C/N"
Columns("D").Replace what:=i, replacement:=k, lookat:=xlPart, MatchCase:=False
Range("D1") = Range("D1") & ", " & Range("C1")
Range(Cells(2, 3), Cells(2, 4)).Value = Null
Range("B1:C1") = Null
Columns("D").ColumnWidth = 68
Sheet1.Range("D1").Copy
Range("A1").Select
End Sub