ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   same function edit vba excel (https://www.excelbanter.com/excel-programming/454605-same-function-edit-vba-excel.html)

[email protected]

same function edit vba excel
 
same function edit vba excel

Dim ws As Worksheet
Dim i As Long

'~~ Change this to the relevant sheet
Set ws = Sheet1

With ws
For i = 1 To 16
.Cells(i, "A").Value = .Cells(i, "E").Value
.Cells(i, "B").Value = .Cells(i, "F").Value
.Cells(i, "C").Value = .Cells(i, "G").Value
Next i
End With



I have VBA Excel as above.

in order to function like the code below what I need to change, yeah



Dim lastRowCount As Integer
totalRow = (Cells(Rows.Count, 1).End(xlUp).Row)
Dim DataRange As Variant
Dim i As Integer
Dim firstRowCount As Integer
firstRowCount = Target.Row
i = 0
DataRange = Sheets("Sheet1").Range("A" & firstRowCount & ":C" & firstRowCount).Value
For Each Item In DataRange


i = i + 1
Next
Dim jsonstring As String
jsonstring = "["& Code1 & Code2 & Code3& "]"



what I changed to be used

Claus Busch

same function edit vba excel
 
Hi,

Am Sun, 8 Mar 2020 20:57:14 -0700 (PDT) schrieb :

same function edit vba excel


try:

Dim ws As Worksheet
Dim i As Long
Dim LRow As Long

'~~ Change this to the relevant sheet
Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 1 To LRow
.Cells(i, "A").Resize(, 3).Value = _
.Cells(i, "E").Resize(, 3).Value
Next i
End With


Regards
Claus B.
--
Windows10
Office 2016

[email protected]

same function edit vba excel
 
thank you for the answer Claus Busch
https://i.imgur.com/wo2u67e.jpg
im trying red line
not moved right, is there a solution for that

[email protected]

same function edit vba excel
 
im try

Sub List1()
Dim ws As Worksheet
Dim i As Long
Dim LRow As Long

'~~ Change this to the relevant sheet
Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 1 To LRow
.Cells(i, "A").Cells(, 3).Value = _
.Cells(i, "E").Cells(, 3).Value
Next i
End With
End Sub
Sub List2()
Dim ws As Worksheet
Dim i As Long
Dim LRow As Long

'~~ Change this to the relevant sheet
Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 1 To LRow
.Cells(i, "B").Cells(, 1).Value = _
.Cells(i, "F").Cells(, 1).Value
Next i
End With
End Sub
Sub List3()
Dim ws As Worksheet
Dim i As Long
Dim LRow As Long

'~~ Change this to the relevant sheet
Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 1 To LRow
.Cells(i, "C").Cells(, 1).Value = _
.Cells(i, "G").Cells(, 1).Value
Next i
End With
End Sub

Sub callList()
Call List1
Call List2
Call List3
End Sub

and same with result

https://i.imgur.com/wo2u67e.jpg

[email protected]

same function edit vba excel
 
im try

Sub List1()
Dim ws As Worksheet
Dim i As Long
Dim LRow As Long

'~~ Change this to the relevant sheet
Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 1 To LRow
.Cells(i, "A").Cells(, 1).Value = _
.Cells(i, "E").Cells(, 1).Value
Next i
End With
End Sub


Sub List2()
Dim ws As Worksheet
Dim i As Long
Dim LRow As Long

'~~ Change this to the relevant sheet
Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 1 To LRow
.Cells(i, "B").Cells(, 1).Value = _
.Cells(i, "F").Cells(, 1).Value
Next i
End With
End Sub


Sub List3()
Dim ws As Worksheet
Dim i As Long
Dim LRow As Long

'~~ Change this to the relevant sheet
Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 1 To LRow
.Cells(i, "C").Cells(, 1).Value = _
.Cells(i, "G").Cells(, 1).Value
Next i
End With
End Sub

Sub callList()
Call List1
Call List2
Call List3
End Sub

and same with result

https://i.imgur.com/wo2u67e.jpg

Claus Busch

same function edit vba excel
 
Hi,

Am Mon, 9 Mar 2020 01:44:08 -0700 (PDT) schrieb :


try:

Set ws = Sheets("Sheet1")

With ws
LRow = .Cells(1, "E").CurrentRegion.Rows.Count
For i = 1 To LRow
.Cells(i, "A").Resize(, 3).Value = _
.Cells(i, "E").Resize(, 3).Value
Next i
End With


Regards
Claus B.
--
Windows10
Office 2016

[email protected]

same function edit vba excel
 
ok, sip thanks and work
https://i.imgur.com/EwaULks.jpg

[email protected]

same function edit vba excel
 
can only fill in the last column of data that hasn't been filled yet,
No need to fill in the fields from the start.
only fill in data that doesn't yet exist

in vba same the above function,


now you fill in from beginning to end.


All times are GMT +1. The time now is 02:38 AM.

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