For j = 1 To numrows - 1
erow = Cells(Rows.count, 10 + j).End(xlUp).Row
totalMins = Cells(erow, 10 + j)
MsgBox (totalMins)
Range(Cells(erow, 10 + j), Cells(erow, 10 + j).End(xlUp)).Cut
Cells(20, 20).PasteSpecial xlPasteValues
Next
继续获取pastespecial范围类失败错误。这是失败的原因是什么,我怎么能纠正我的代码。
答案 0 :(得分:2)
您无法从剪切中粘贴特殊内容。使用:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</form>
<?php
// Only process the form if $_POST isn't empty
if ( ! empty( $_POST ) ) {
// Connect to MySQL
$mysqli = new mysqli( 'localhost', 'user', 'mypass', 'dbname' );
// Check our connection
if ( $mysqli->connect_error ) {
die( 'Connect Error: ' . $mysqli->connect_errno . ': ' . $mysqli->connect_error );
}
$ID=$_POST['ID'] ;
$RYP=$_POST['RYP'] ;
$SHE=$_POST['SHE'] ;
$SCO=$_POST['SCO'] ;
$CName=$_POST['CName'] ;
$Contact= $_POST['Contact'] ;
$Address=$_POST['Address'] ;
$City=$_POST['City'] ;
$State=$_POST['State'] ;
$Zip=$_POST['Zip'] ;
$Phone1=$_POST['Phone1'] ;
$Phone2=$_POST['Phone2'] ;
$EMail=$_POST['EMail'] ;
$Web=$_POST['Web'] ;
$sql = ("SELECT * FROM DEALERS WHERE 'ID' = $ID");
$sql = ("UPDATE dealers WHERE `ID`='$ID'(RYP, SHE, SCO, CName,Contact,Address,City, State, Zip, Phone1, Phone2, EMail, Web)
VALUES ('$RYP','$SHE','$SCO','$CName','$Contact','$Address','$City', '$State','$Zip','$Phone1','$Phone2','$EMail','$Web')");
}
?>
<form method="post">
<table>
<tr>
<td>RYP</td>
<td><input type="checkbox" name="author" value="<?php $row['RYP'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>SHE</td>
<td><input type="checkbox" name="author" value="<?php $row['SHE'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>SCO</td>
<td><input type="checkbox" name="author" value="<?php $row['SCO'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>Contact</td>
<td><input type="text" name="author" value="<?php $row['Contact'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="name" value="<?php $row['Address'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>City</td>
<td><input type="text" name="copy" value="<?php $row['City'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>State</td>
<td><input type="text" name="copy" value="<?php $row['State'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>Zip</td>
<td><input type="text" name="copy" value="<?php $row['Zip'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>Phone1</td>
<td><input type="text" name="copy" value="<?php $row['Phone1'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>Phone2</td>
<td><input type="text" name="copy" value="<?php $row['Phone2'] ?>" class="form-control"/></td>
</tr><tr>
<td>EMail</td>
<td><input type="text" name="copy" value="<?php $row['EMail'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>Web</td>
<td><input type="text" name="copy" value="<?php $row['Web'] ?>" class="form-control"/></td>
</tr>
<tr>
<td>CName</td>
<td><input type="text" name="title" value="<?php $row['CName'] ?>"class="form-control"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="submit" class="btn btn-success btn-lg"/></td>
</tr>
</table>
</form></body>
或者更好:
For j = 1 To numrows - 1
erow = Cells(Rows.count, 10 + j).End(xlUp).Row
totalMins = Cells(erow, 10 + j)
MsgBox (totalMins)
Range(Cells(erow, 10 + j), Cells(erow, 10 + j).End(xlUp)).Cut Cells(20, 20)
Next