如何确定Excel工作表中的最后一行,包括中间的一些空行?
有了这个功能:
Function ultimaFilaBlanco(col As String) As Long
Dim lastRow As Long
With ActiveSheet
lastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, col).End(xlUp).row
End With
ultimaFilaBlanco = lastRow
End Function
Run Code Online (Sandbox Code Playgroud)
这个数据:
Row 1 : Value
Row 2 : Value
Row 3 : Value
Row 4 : Value
Row 5 : Value
Row 6 : White
Row 7 : Value
Row 8 : Value
Row 9 : Value
Row 10 : White
Row 11 : White
Row 12 : White
Row 13 : Value
Row 14 …Run Code Online (Sandbox Code Playgroud) 我必须在Excel表格中找到一个值celda.我正在使用这个vba代码来找到它:
Set cell = Cells.Find(What:=celda, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False)
If cell Is Nothing Then
'do it something
Else
'do it another thing
End If
Run Code Online (Sandbox Code Playgroud)
问题是当我必须只在excel列中找到值时.我用下一个代码找到它:
Columns("B:B").Select
Selection.Find(What:="VA22GU1", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Run Code Online (Sandbox Code Playgroud)
但我不知道如何使它适应第一个vba代码,因为我必须使用该值nothing.
可能重复:
带有特殊字符的读/写.txt文件
我正在阅读一个文件,但我不知道如何阅读口音和特殊字符,这里是mo代码阅读我读了我必须添加一个不同的编码,但我不知道怎么做
File file = new File("C://fichero.csv");
BufferedReader bufRdr = new BufferedReader(new FileReader(file));
String line = null;
line = bufRdr.readLine();
Run Code Online (Sandbox Code Playgroud)
谢谢
我有两个具有相同列的表.
我可以将它们合并 UNION
select * from table1
union
select * from table2;
Run Code Online (Sandbox Code Playgroud)
如何使用与该查询相同的内容和列创建新表?
你好,我有一个多几何体,当你传递鼠标appair线时,怎样有一个像翻转的样式,我的问题是多几何中的差异线串有可能的不同颜色?
在下一个例子中,当你选择了一个样式时,我有地标Durham Tees Valley,但我希望这两行有不同的颜色.
谢谢
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>UK & Ireland, Flight Maps</name>
<open>1</open>
<LookAt>
<longitude>-3.478829007934099</longitude>
<latitude>52.50255557278696</latitude>
<altitude>0</altitude>
<range>730703.2034581316</range>
<tilt>53.03089122623036</tilt>
<heading>30.72599120906411</heading>
</LookAt>
<Style id="test">
<LineStyle>
<color>ff235523</color>
<width>0.5</width>
</LineStyle>
</Style>
<Style id="doc"><ListStyle><ItemIcon><state>open closed</state><href>http://maps.google.com/mapfiles/kml/shapes/airports.png</href></ItemIcon></ListStyle></Style>
<Style id="airportfolder"><ListStyle><ItemIcon><state>open closed</state><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></ItemIcon></ListStyle></Style>
<Style id="info"><ListStyle><listItemType>checkHideChildren</listItemType><ItemIcon><state>open closed</state><href>http://www.barnabu.co.uk/files/icons/info.png</href></ItemIcon></ListStyle></Style>
<Style id="sh_spider"><IconStyle><scale>1.2</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ff001111</color><scale>1.4</scale></LabelStyle><LineStyle><width>0.5</width><color>ffff111f</color></LineStyle></Style>
<Style id="sn_spider"><IconStyle><scale>0.7</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ffb5b5b5</color><scale>0.9</scale></LabelStyle><LineStyle><color>00ff11ff</color></LineStyle></Style>
<StyleMap id="spider"><Pair><key>normal</key><styleUrl>#sn_spider</styleUrl></Pair><Pair><key>highlight</key><styleUrl>#sh_spider</styleUrl></Pair></StyleMap>
<Style id="2_sh_spider"><IconStyle><scale>1.2</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ff110011</color><scale>1.4</scale></LabelStyle><LineStyle><width>0.5</width><color>ff11111f</color></LineStyle></Style>
<Style id="2_sn_spider"><IconStyle><scale>0.7</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ff11ffb5</color><scale>0.9</scale></LabelStyle><LineStyle><color>001111ff</color></LineStyle></Style>
<StyleMap id="2_spider"><Pair><key>normal</key><styleUrl>#2_sn_spider</styleUrl></Pair><Pair><key>highlight</key><styleUrl>#2_sh_spider</styleUrl></Pair></StyleMap>
<styleUrl>#doc</styleUrl>
<Folder><name>Airports</name>
<styleUrl>#airportfolder</styleUrl>
<Placemark><name>Durham Tees Valley</name><description></description>
<Snippet maxLines="0"></Snippet><styleUrl>#2_spider</styleUrl><MultiGeometry><LineString><altitudeMode>relativeToGround</altitudeMode><coordinates>-1.426979,54.5105876,0 -1.37505058232182,54.3588196840161,8130.76624025246 -1.32350445540046,54.2070296447423,15640.4403479026 -1.27233575193875,54.0552177670135,22453.9881416349 -1.22153968418068,53.90338433094,28503.3309041539 -1.17111154230159,53.7515296120054,33728.0256022233 -1.12104669283672,53.5996538811612,38075.8688134745 -1.07134057714712,53.4477574049198,41503.4183257466 -1.02198870992187,53.2958404454444,43976.4271973102 -0.972986677715595,53.1439032606379,45470.1859409886 -0.924330137520422,52.9919461042286,45969.769413186 -0.876014815371306,52.8399692258547,45470.1859409886 -0.828036504983954,52.6879728711457,43976.4271973102 -0.780391066424406,52.5359572818033,41503.4183257466 -0.733074424809449,52.3839226956791,38075.8688134745 -0.686082569037039,52.2318693468513,33728.0256022233 -0.639411550545936,52.0797974656991,28503.3309041538 -0.593057482103787,51.9277072789755,22453.9881416349 -0.547016536622892,51.7755990098789,15640.4403479026 -0.501284946002942,51.623472878122,8130.76624025247 …Run Code Online (Sandbox Code Playgroud) 我有一个fila带有Excel值的完整行的变量
问题是,当我在Excel中#N/A,VBA采用该值时Error 2042.
我无法将该值赋给valor 并产生错误.在此之前一切正常,现在我正在尝试定义一个On Error Goto转到循环中的下一个迭代For,但我不知道为什么VBA不处理错误.
Do While Not IsEmpty(ActiveCell)
txt = ActiveCell.Value2
cell = ActiveCell.Offset(0, 1).Value2
fila = Range("C20:F20")
For j = 1 To UBound(fila, 2)
On Error GoTo Siguiente
If Not IsEmpty(fila(1, j)) Then
valor = fila(1, j)
cmd = Cells(1, j + 2).Value2
devolver = function1(cmd, txt, cell, valor)
arrayDevolver(p) = devolver
p = p + 1
End If
Siguiente:
Next
Loop
Run Code Online (Sandbox Code Playgroud) 你好我在KML中有一个Multigeometry,但是当我在地标上设置一个名称时,我的地标中的两个点都有相同的名称,任何地标中的点都有不同的名称,这是我的代码示例
<Placemark>
<name>TEST</name>
<description></description>
<visibility>1</visibility>
<tessellate>1</tessellate>
<styleUrl>#StyTEST</styleUrl>
<MultiGeometry>
<Point>
<coordinates>-3.6655,40.4364</coordinates>
</Point>
<Point>
<coordinates>-3.6726,40.4308</coordinates>
</Point>
<LineString>
<tessellate>1</tessellate>
<coordinates>
-3.6655,40.4364
-3.6726,40.4308
</coordinates>
</LineString>
</MultiGeometry>
</Placemark>
Run Code Online (Sandbox Code Playgroud) 我有两个excel工作簿Book_A和Book_B,我知道如何从A - > B复制整张表格:
wksSh1.Copy Before:=wkbBook_B.Sheets(1)
Run Code Online (Sandbox Code Playgroud)
但我只想复制包含值和格式而不是公式的表格.它是可行的
有一种方法可以使用 VBA 删除数组中的所有重复项,包括第一个值。仅保留不重复的值
例子:
Array_1 ['pedro','maria','jose','jesus','pepe','pepe','jose']
Run Code Online (Sandbox Code Playgroud)
结果:
Array_1 ['pedro','maria','jesus']
Run Code Online (Sandbox Code Playgroud)