我只是在H列中的单元格为空时才尝试将内容从H列复制到C列。
如果H为空,我想留下C列中的文字。
这是我所拥有的,它复制了H的内容,但是如果H为空,它也会清空C列。
Sub Button1_Click()
Dim lngRow As Long
Dim BotRow As Long
Cells(Rows.Count, "H").Select
Selection.End(xlUp).Select
BotRow = Selection.Row
For lngRow = 1 To BotRow
If Not IsEmpty(Cells(lngRow, "H")) Then
Cells(lngRow, "C") = Cells(lngRow, "H")
End If
Next
End Sub
答案 0 :(得分:1)
public class SearchResultBaseFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//View v = inflater.inflate(R.layout.activity_slide_profile, null);
View v = inflater.inflate(R.layout.dl, null);
return v;
}
@Override
public void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
public SearchResultBaseFragment() {
this._lat = 0;
this._long = 0;
}
public SearchResultBaseFragment(double _lat, double _long) {
this._lat = _lat;
this._long = _long;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
[...]
}
= vbNullString
,因此只有在有数据时才会将数据从H传输到C:
""
答案 1 :(得分:0)
Option Explicit
Dim i As Long
Dim n As Long
Sub Copy()
n = ActiveSheet.Cells(Rows.Count, "H").End(xlUp).Row
For i = 1 To n
If Cells(i, 8).Value <> vbNullString Then
Cells(i, 3).Value = Cells(i, 1).Value
End If
Next i
End Sub