Operacje na arkuszach VBA

Działanie makra często wymaga wykonania operacji na arkuszach. Arkusze Excel jako obiekty posiadają wiele tzw. metod, dzięki którym możliwe jest nie tylko przechodzenie między nimi, ale również dodawanie, przemieszczanie, zmiana nazwy, usuwanie i wiele innych.

Dowiedz się w jaki sposób odnosić się do arkuszy za pomocą ich nazw, oraz pozycji na której się znajdują, a także jak zatosować niektóre spośród wielu metod i właściwości dostępnych w edytorze VBA.

W filme dodatkowo użyto:

  • funkcji Add i Delete,
  • funkcji Move,
  • właściwości Count.

 

Czas trwania 0
Trudność: Łatwa
Nie masz jeszcze dostępu do tej lekcji. Poczekaj aż uzyskasz dostęp w ramach swojego abonamentu lub wykup pełen dostęp.
Kup dostęp
Whoops! There was an error.
ErrorException (E_WARNING)
file_put_contents(): Only 0 of 246 bytes written, possibly out of free disk space ErrorException thrown with message "file_put_contents(): Only 0 of 246 bytes written, possibly out of free disk space" Stacktrace: #7 ErrorException in /home/iexcelst/domains/ivba.pl/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122 #6 file_put_contents in /home/iexcelst/domains/ivba.pl/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122 #5 Illuminate\Filesystem\Filesystem:put in /home/iexcelst/domains/ivba.pl/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php:83 #4 Illuminate\Session\FileSessionHandler:write in /home/iexcelst/domains/ivba.pl/vendor/laravel/framework/src/Illuminate/Session/Store.php:128 #3 Illuminate\Session\Store:save in /home/iexcelst/domains/ivba.pl/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:87 #2 Illuminate\Session\Middleware\StartSession:terminate in /home/iexcelst/domains/ivba.pl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:218 #1 Illuminate\Foundation\Http\Kernel:terminateMiddleware in /home/iexcelst/domains/ivba.pl/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:189 #0 Illuminate\Foundation\Http\Kernel:terminate in /home/iexcelst/domains/ivba.pl/public/index.php:58
7
ErrorException
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Filesystem
/
Filesystem.php
122
6
file_put_contents
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Filesystem
/
Filesystem.php
122
5
Illuminate
\
Filesystem
\
Filesystem
put
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Session
/
FileSessionHandler.php
83
4
Illuminate
\
Session
\
FileSessionHandler
write
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Session
/
Store.php
128
3
Illuminate
\
Session
\
Store
save
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Session
/
Middleware
/
StartSession.php
87
2
Illuminate
\
Session
\
Middleware
\
StartSession
terminate
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Foundation
/
Http
/
Kernel.php
218
1
Illuminate
\
Foundation
\
Http
\
Kernel
terminateMiddleware
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Foundation
/
Http
/
Kernel.php
189
0
Illuminate
\
Foundation
\
Http
\
Kernel
terminate
/
public
/
index.php
58
/
home
/
iexcelst
/
domains
/
ivba.pl
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Filesystem
/
Filesystem.php
     *
     * @param  string  $path
     * @return string
     */
    public function hash($path)
    {
        return md5_file($path);
    }
 
    /**
     * Write the contents of a file.
     *
     * @param  string  $path
     * @param  string  $contents
     * @param  bool  $lock
     * @return int
     */
    public function put($path, $contents, $lock = false)
    {
        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }
 
    /**
     * Prepend to a file.
     *
     * @param  string  $path
     * @param  string  $data
     * @return int
     */
    public function prepend($path, $data)
    {
        if ($this->exists($path)) {
            return $this->put($path, $data.$this->get($path));
        }
 
        return $this->put($path, $data);
    }
 
    /**
     * Append to a file.
Arguments
  1. "file_put_contents(): Only 0 of 246 bytes written, possibly out of free disk space"
    
/
home
/
iexcelst
/
domains
/
ivba.pl
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Filesystem
/
Filesystem.php
     *
     * @param  string  $path
     * @return string
     */
    public function hash($path)
    {
        return md5_file($path);
    }
 
    /**
     * Write the contents of a file.
     *
     * @param  string  $path
     * @param  string  $contents
     * @param  bool  $lock
     * @return int
     */
    public function put($path, $contents, $lock = false)
    {
        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }
 
    /**
     * Prepend to a file.
     *
     * @param  string  $path
     * @param  string  $data
     * @return int
     */
    public function prepend($path, $data)
    {
        if ($this->exists($path)) {
            return $this->put($path, $data.$this->get($path));
        }
 
        return $this->put($path, $data);
    }
 
    /**
     * Append to a file.
Arguments
  1. "/home/iexcelst/domains/ivba.pl/storage/framework/sessions/gNV79Rm2aSxw86VpBLeEcfe7CD92v56Q2DBbBxAc"
    
  2. "a:4:{s:6:"_token";s:40:"zgCr76dLo80qpIVN80mk2DsdMZK4GClPtWuU5wdH";s:9:"_previous";a:1:{s:3:"url";s:52:"http://blog.ivba.pl/lesson/operacje-na-arkuszach-vba";}s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}"
    
  3. 2
    
/
home
/
iexcelst
/
domains
/
ivba.pl
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Session
/
FileSessionHandler.php
    /**
     * {@inheritdoc}
     */
    public function read($sessionId)
    {
        if ($this->files->exists($path = $this->path.'/'.$sessionId)) {
            if (filemtime($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) {
                return $this->files->get($path, true);
            }
        }
 
        return '';
    }
 
    /**
     * {@inheritdoc}
     */
    public function write($sessionId, $data)
    {
        $this->files->put($this->path.'/'.$sessionId, $data, true);
 
        return true;
    }
 
    /**
     * {@inheritdoc}
     */
    public function destroy($sessionId)
    {
        $this->files->delete($this->path.'/'.$sessionId);
 
        return true;
    }
 
    /**
     * {@inheritdoc}
     */
    public function gc($lifetime)
    {
        $files = Finder::create()
Arguments
  1. "/home/iexcelst/domains/ivba.pl/storage/framework/sessions/gNV79Rm2aSxw86VpBLeEcfe7CD92v56Q2DBbBxAc"
    
  2. "a:4:{s:6:"_token";s:40:"zgCr76dLo80qpIVN80mk2DsdMZK4GClPtWuU5wdH";s:9:"_previous";a:1:{s:3:"url";s:52:"http://blog.ivba.pl/lesson/operacje-na-arkuszach-vba";}s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}"
    
  3. true
    
/
home
/
iexcelst
/
domains
/
ivba.pl
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Session
/
Store.php
     *
     * @param  string  $data
     * @return string
     */
    protected function prepareForUnserialize($data)
    {
        return $data;
    }
 
    /**
     * Save the session data to storage.
     *
     * @return bool
     */
    public function save()
    {
        $this->ageFlashData();
 
        $this->handler->write($this->getId(), $this->prepareForStorage(
            serialize($this->attributes)
        ));
 
        $this->started = false;
    }
 
    /**
     * Prepare the serialized session data for storage.
     *
     * @param  string  $data
     * @return string
     */
    protected function prepareForStorage($data)
    {
        return $data;
    }
 
    /**
     * Age the flash data for the session.
     *
     * @return void
Arguments
  1. "gNV79Rm2aSxw86VpBLeEcfe7CD92v56Q2DBbBxAc"
    
  2. "a:4:{s:6:"_token";s:40:"zgCr76dLo80qpIVN80mk2DsdMZK4GClPtWuU5wdH";s:9:"_previous";a:1:{s:3:"url";s:52:"http://blog.ivba.pl/lesson/operacje-na-arkuszach-vba";}s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}"
    
/
home
/
iexcelst
/
domains
/
ivba.pl
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Session
/
Middleware
/
StartSession.php
        if ($this->sessionConfigured()) {
            $this->storeCurrentUrl($request, $session);
 
            $this->addCookieToResponse($response, $session);
        }
 
        return $response;
    }
 
    /**
     * Perform any final actions for the request lifecycle.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Symfony\Component\HttpFoundation\Response  $response
     * @return void
     */
    public function terminate($request, $response)
    {
        if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) {
            $this->manager->driver()->save();
        }
    }
 
    /**
     * Start the session for the given request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Contracts\Session\Session
     */
    protected function startSession(Request $request)
    {
        return tap($this->getSession($request), function ($session) use ($request) {
            $session->setRequestOnHandler($request);
 
            $session->start();
        });
    }
 
    /**
     * Get the session implementation from the manager.
/
home
/
iexcelst
/
domains
/
ivba.pl
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Foundation
/
Http
/
Kernel.php
     * @return void
     */
    protected function terminateMiddleware($request, $response)
    {
        $middlewares = $this->app->shouldSkipMiddleware() ? [] : array_merge(
            $this->gatherRouteMiddleware($request),
            $this->middleware
        );
 
        foreach ($middlewares as $middleware) {
            if (! is_string($middleware)) {
                continue;
            }
 
            list($name) = $this->parseMiddleware($middleware);
 
            $instance = $this->app->make($name);
 
            if (method_exists($instance, 'terminate')) {
                $instance->terminate($request, $response);
            }
        }
    }
 
    /**
     * Gather the route middleware for the given request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    protected function gatherRouteMiddleware($request)
    {
        if ($route = $request->route()) {
            return $this->router->gatherRouteMiddleware($route);
        }
 
        return [];
    }
 
    /**
Arguments
  1. Request {#42
      #json: null
      #convertedFiles: []
      #userResolver: Closure {#429
        class: "Illuminate\Auth\AuthServiceProvider"
        this: AuthServiceProvider {#41 …}
        parameters: {
          $guard: {
            default: null
          }
        }
        use: {
          $app: Application {#2 …}
        }
      }
      #routeResolver: Closure {#426
        class: "Illuminate\Routing\Router"
        this: Router {#25 …}
        use: {
          $route: Route {#273 …}
        }
      }
      +attributes: ParameterBag {#44}
      +request: ParameterBag {#50}
      +query: ParameterBag {#50}
      +server: ServerBag {#46}
      +files: FileBag {#47}
      +cookies: ParameterBag {#45}
      +headers: HeaderBag {#48}
      #content: null
      #languages: null
      #charsets: null
      #encodings: null
      #acceptableContentTypes: array:4 [
        0 => "text/html"
        1 => "application/xhtml+xml"
        2 => "application/xml"
        3 => "*/*"
      ]
      #pathInfo: "/lesson/operacje-na-arkuszach-vba"
      #requestUri: "/lesson/operacje-na-arkuszach-vba"
      #baseUrl: ""
      #basePath: null
      #method: "GET"
      #format: null
      #session: Store {#477}
      #locale: null
      #defaultLocale: "en"
      -isHostValid: true
      -isForwardedValid: true
      basePath: ""
      format: "html"
    }
    
  2. Response {#580}
    
/
home
/
iexcelst
/
domains
/
ivba.pl
/
vendor
/
laravel
/
framework
/
src
/
Illuminate
/
Foundation
/
Http
/
Kernel.php
     */
    protected function dispatchToRouter()
    {
        return function ($request) {
            $this->app->instance('request', $request);
 
            return $this->router->dispatch($request);
        };
    }
 
    /**
     * Call the terminate method on any terminable middleware.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Http\Response  $response
     * @return void
     */
    public function terminate($request, $response)
    {
        $this->terminateMiddleware($request, $response);
 
        $this->app->terminate();
    }
 
    /**
     * Call the terminate method on any terminable middleware.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Http\Response  $response
     * @return void
     */
    protected function terminateMiddleware($request, $response)
    {
        $middlewares = $this->app->shouldSkipMiddleware() ? [] : array_merge(
            $this->gatherRouteMiddleware($request),
            $this->middleware
        );
 
        foreach ($middlewares as $middleware) {
            if (! is_string($middleware)) {
Arguments
  1. Request {#42
      #json: null
      #convertedFiles: []
      #userResolver: Closure {#429
        class: "Illuminate\Auth\AuthServiceProvider"
        this: AuthServiceProvider {#41 …}
        parameters: {
          $guard: {
            default: null
          }
        }
        use: {
          $app: Application {#2 …}
        }
      }
      #routeResolver: Closure {#426
        class: "Illuminate\Routing\Router"
        this: Router {#25 …}
        use: {
          $route: Route {#273 …}
        }
      }
      +attributes: ParameterBag {#44}
      +request: ParameterBag {#50}
      +query: ParameterBag {#50}
      +server: ServerBag {#46}
      +files: FileBag {#47}
      +cookies: ParameterBag {#45}
      +headers: HeaderBag {#48}
      #content: null
      #languages: null
      #charsets: null
      #encodings: null
      #acceptableContentTypes: array:4 [
        0 => "text/html"
        1 => "application/xhtml+xml"
        2 => "application/xml"
        3 => "*/*"
      ]
      #pathInfo: "/lesson/operacje-na-arkuszach-vba"
      #requestUri: "/lesson/operacje-na-arkuszach-vba"
      #baseUrl: ""
      #basePath: null
      #method: "GET"
      #format: null
      #session: Store {#477}
      #locale: null
      #defaultLocale: "en"
      -isHostValid: true
      -isForwardedValid: true
      basePath: ""
      format: "html"
    }
    
  2. Response {#580}
    
/
home
/
iexcelst
/
domains
/
ivba.pl
/
public
/
index.php
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
 
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
 
$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);
 
$response->send();
 
$kernel->terminate($request, $response);
 
Arguments
  1. Request {#42
      #json: null
      #convertedFiles: []
      #userResolver: Closure {#429
        class: "Illuminate\Auth\AuthServiceProvider"
        this: AuthServiceProvider {#41 …}
        parameters: {
          $guard: {
            default: null
          }
        }
        use: {
          $app: Application {#2 …}
        }
      }
      #routeResolver: Closure {#426
        class: "Illuminate\Routing\Router"
        this: Router {#25 …}
        use: {
          $route: Route {#273 …}
        }
      }
      +attributes: ParameterBag {#44}
      +request: ParameterBag {#50}
      +query: ParameterBag {#50}
      +server: ServerBag {#46}
      +files: FileBag {#47}
      +cookies: ParameterBag {#45}
      +headers: HeaderBag {#48}
      #content: null
      #languages: null
      #charsets: null
      #encodings: null
      #acceptableContentTypes: array:4 [
        0 => "text/html"
        1 => "application/xhtml+xml"
        2 => "application/xml"
        3 => "*/*"
      ]
      #pathInfo: "/lesson/operacje-na-arkuszach-vba"
      #requestUri: "/lesson/operacje-na-arkuszach-vba"
      #baseUrl: ""
      #basePath: null
      #method: "GET"
      #format: null
      #session: Store {#477}
      #locale: null
      #defaultLocale: "en"
      -isHostValid: true
      -isForwardedValid: true
      basePath: ""
      format: "html"
    }
    
  2. Response {#580}
    

Environment & details:

empty
empty
empty
empty
empty
Key Value
#LSAPI_SLOW_REQ_MSECS
"10000"
MAGICK_THREAD_LIMIT
"1"
PATH
"/bin:/usr/bin:/usr/local/bin"
HTTP_ACCEPT
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_ENCODING
"x-gzip, gzip, deflate"
HTTP_HOST
"blog.ivba.pl"
HTTP_USER_AGENT
"CCBot/2.0 (http://commoncrawl.org/faq/)"
DOCUMENT_ROOT
"/home/iexcelst/domains/ivba.pl/public_html"
REMOTE_ADDR
"54.224.234.8"
REMOTE_PORT
"42350"
SERVER_ADDR
"128.204.216.201"
SERVER_NAME
"blog.ivba.pl"
SERVER_ADMIN
"webmaster@ivba.pl"
SERVER_PORT
"80"
REQUEST_URI
"/lesson/operacje-na-arkuszach-vba"
REDIRECT_URL
"/lesson/operacje-na-arkuszach-vba"
GEOIP_ADDR
"54.224.234.8"
GEOIP_COUNTRY_CODE
"US"
GEOIP_COUNTRY_NAME
"United States"
GEOIP_CONTINENT_CODE
"NA"
REDIRECT_STATUS
"200"
SCRIPT_FILENAME
"/home/iexcelst/domains/ivba.pl/public_html/index.php"
QUERY_STRING
""
SCRIPT_URI
"http://blog.ivba.pl/lesson/operacje-na-arkuszach-vba"
SCRIPT_URL
"/lesson/operacje-na-arkuszach-vba"
SCRIPT_NAME
"/index.php"
SERVER_PROTOCOL
"HTTP/1.0"
SERVER_SOFTWARE
"LiteSpeed"
REQUEST_METHOD
"GET"
X-LSCACHE
"on"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1524184710.2054
REQUEST_TIME
1524184710
APP_NAME
"iVBA.pl"
APP_ENV
"production"
APP_KEY
"base64:KMX7UaPvOZ2yb5aNtaadLPNMLcvh1EeRkh0CUKvZpGA="
APP_DEBUG
"true"
DB_CONNECTION
"mysql"
DB_HOST
"localhost"
DB_PORT
"3306"
DB_DATABASE
"iexcelst_ivba"
DB_USERNAME
"iexcelst_ivba"
DB_PASSWORD
"Insekt1!"
BROADCAST_DRIVER
"log"
CACHE_DRIVER
"file"
SESSION_DRIVER
"file"
QUEUE_DRIVER
"sync"
REDIS_HOST
"127.0.0.1"
REDIS_PASSWORD
"null"
REDIS_PORT
"6379"
PUSHER_APP_ID
""
PUSHER_APP_KEY
""
PUSHER_APP_SECRET
""
NOCAPTCHA_SECRET
"6LeZ1C4UAAAAADzsgTkh24JdHNyCLyHL87r5RHdz"
NOCAPTCHA_SITEKEY
"6LeZ1C4UAAAAAMrvPuWkZve90TIDnubnnBB7gArg"
PAYU_ENV
"sandbox"
PAYU_POSID
"301519"
PAYU_KEY1
"155d4321403d610b7497601deada8dba"
PAYU_KEY2
"bc6bd3e1b465de13e5fc3cb27f203718"
Key Value
#LSAPI_SLOW_REQ_MSECS
"10000"
MAGICK_THREAD_LIMIT
"1"
PATH
"/bin:/usr/bin:/usr/local/bin"
APP_NAME
"iVBA.pl"
APP_ENV
"production"
APP_KEY
"base64:KMX7UaPvOZ2yb5aNtaadLPNMLcvh1EeRkh0CUKvZpGA="
APP_DEBUG
"true"
DB_CONNECTION
"mysql"
DB_HOST
"localhost"
DB_PORT
"3306"
DB_DATABASE
"iexcelst_ivba"
DB_USERNAME
"iexcelst_ivba"
DB_PASSWORD
"Insekt1!"
BROADCAST_DRIVER
"log"
CACHE_DRIVER
"file"
SESSION_DRIVER
"file"
QUEUE_DRIVER
"sync"
REDIS_HOST
"127.0.0.1"
REDIS_PASSWORD
"null"
REDIS_PORT
"6379"
PUSHER_APP_ID
""
PUSHER_APP_KEY
""
PUSHER_APP_SECRET
""
NOCAPTCHA_SECRET
"6LeZ1C4UAAAAADzsgTkh24JdHNyCLyHL87r5RHdz"
NOCAPTCHA_SITEKEY
"6LeZ1C4UAAAAAMrvPuWkZve90TIDnubnnBB7gArg"
PAYU_ENV
"sandbox"
PAYU_POSID
"301519"
PAYU_KEY1
"155d4321403d610b7497601deada8dba"
PAYU_KEY2
"bc6bd3e1b465de13e5fc3cb27f203718"
0. Whoops\Handler\PrettyPageHandler