我已经在该站点和许多其他站点上进行了查找,但没有在我要查找的Excel VBA中找到确切的代码段。可能不是以正确的方式询问。我有一本工作簿,该工作簿在一年中的每一天都有一个工作表,例如“ mmddyy”。我试图找到的是一段代码,它将循环遍历每个工作表,特别是查看单元格位置D1,直到找到该单元格为空的第一个工作表。然后运行由几条复制/粘贴命令组成的代码的其余部分,这些命令以在单元格D1中粘贴日期结尾,因此当脚本在第二天运行时,它现在越过了刚刚粘贴到的工作表。
答案 0 :(得分:2)
sub FindBlank()
Dim ws as worksheet
For Each ws in ThisworkBook.Worksheets
If ws.Range("D1") = "" Then
ws.Activate
Exit For
End If
Next ws
End Sub
将第一个工作表的d1空白保留为活动工作表
答案 1 :(得分:0)
<?php
require_once './aliyun-php-sdk/aliyun-php-sdk-core/Config.php';
require_once './aliyun-php-sdk/aliyun-oss-php-sdk-2.2.4/autoload.php';
use vod\Request\V20170321 as vod;
use OSS\OssClient;
use OSS\Core\OssException;
function init_vod_client($accessKeyId, $accessKeySecret) {
$regionId = 'cn-shanghai';
$profile = DefaultProfile::getProfile($regionId, $accessKeyId, $accessKeySecret);
return new DefaultAcsClient($profile);
}
function create_upload_video($vodClient) {
$request = new vod\CreateUploadVideoRequest();
$request->setTitle("Movie");
$request->setFileName("elephant.mov");
$request->setDescription("It is about elephant");
$request->setCoverURL("http://img.alicdn.com/tps/TB1qnJ1PVXXXXXCXXXXXXXXXXXX-700-700.png");
$request->setTags("forest,elephant");
return $vodClient->getAcsResponse($request);
}
function refresh_upload_video($vodClient, $videoId) {
$request = new vod\RefreshUploadVideoRequest();
$request->setVideoId($videoId);
return $vodClient->getAcsResponse($request);
}
function init_oss_client($uploadAuth, $uploadAddress) {
$ossClient = new OssClient($uploadAuth['AccessKeyId'], $uploadAuth['AccessKeySecret'], $uploadAddress['Endpoint'],
false, $uploadAuth['SecurityToken']);
$ossClient->setTimeout(86400*7);
$ossClient->setConnectTimeout(10);
return $ossClient;
}
function upload_local_file($ossClient, $uploadAddress, $localFile) {
return $ossClient->uploadFile($uploadAddress['Bucket'], $uploadAddress['FileName'], $localFile);
}
function multipart_upload_file($ossClient, $uploadAddress, $localFile) {
return $ossClient->multiuploadFile($uploadAddress['Bucket'], $uploadAddress['FileName'], $localFile);
}
$accessKeyId = '<AccessKeyId>';
$accessKeySecret = '<AccessKeySecret>';
$localFile = '/Users/yours/Video/testVideo.flv';
try {
$vodClient = init_vod_client($accessKeyId, $accessKeySecret);
$createRes = create_upload_video($vodClient);
$videoId = $createRes->VideoId;
$uploadAddress = json_decode(base64_decode($createRes->UploadAddress), true);
$uploadAuth = json_decode(base64_decode($createRes->UploadAuth), true);
$ossClient = init_oss_client($uploadAuth, $uploadAddress);
//$result = upload_local_file($ossClient, $uploadAddress, $localFile);
$result = multipart_upload_file($ossClient, $uploadAddress, $localFile);
printf("Succeed, VideoId: %s", $videoId);
} catch (Exception $e) {
// var_dump($e);
printf("Failed, ErrorMessage: %s", $e->getMessage());
}