Av8tordude
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 1,074
- Office Version
- 2019
- Platform
- Windows
I use these two codes to import or export data into my sheet, however, how can I merge them?
In this code,...
This code difference is ...
For Each c In .Columns(1).Cells
vs
For Each c In .Columns(19).Cells
and the first code does not have .Name = Wks.Cells(c.Row, "A").Value & Format(Wks.Cells(c.Row, "O").Value * 100, "00000000000")
In this code,...
VBA Code:
For Each c In Wks.Range("A7:A" & lRow)
If Not c.Comment Is Nothing Then
With BkUp.Sheets(1).Cells(c.Row - 6, "S")
.Value = .Value & COMMENT_DELIMITER & c.Comment.Text
End With
End If
Next c
For Each c In Wks.Range("S7:S" & lRow)
If Not c.Comment Is Nothing Then
With BkUp.Sheets(1).Cells(c.Row - 6, "S")
.Value = .Value & COMMENT_DELIMITER & c.Comment.Text
End With
End If
Next c
This code difference is ...
For Each c In .Columns(1).Cells
vs
For Each c In .Columns(19).Cells
and the first code does not have .Name = Wks.Cells(c.Row, "A").Value & Format(Wks.Cells(c.Row, "O").Value * 100, "00000000000")
VBA Code:
If UBound(Data, 2) >= 19 Then
For Each c In .Columns(1).Cells
If InStr(1, c.Value, COMMENT_DELIMITER) Then
v = Split(c.Value, COMMENT_DELIMITER)
c.Value = v(0)
c.AddComment Text:=v(1)
c.Comment.Shape.TextFrame.AutoSize = True
With Wks.Shapes.AddShape(msoShapeRightTriangle, c.Left, c.Top, 7, 7)
.Rotation = 90
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Solid
.Line.Visible = msoFalse
.OnAction = "ImageTag"
End With
End If
Next c
End If
If UBound(Data, 2) >= 19 Then
For Each c In .Columns(19).Cells
If InStr(1, c.Value, COMMENT_DELIMITER) Then
v = Split(c.Value, COMMENT_DELIMITER)
c.Value = v(0)
c.AddComment Text:=v(1)
c.Comment.Shape.TextFrame.AutoSize = True
With Wks.Shapes.AddShape(msoShapeRightTriangle, c.Left, c.Top, 7, 7)
.Name = Wks.Cells(c.Row, "A").Value & Format(Wks.Cells(c.Row, "O").Value * 100, "00000000000")
.Rotation = 90
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Solid
.Line.Visible = msoFalse
.OnAction = "Remarks"
End With
End If
Next c
End If